Hereford were relegated from League Two despite defeating Torquay, who also missed out on automatic promotion.
Delroy Facey's header, Harry Pell's penalty and Robert Purdie's strike gave the hosts a 3-0 half-time lead.
Torquay pulled one back just 28 seconds after the restart through Ryan Jarvis from close range while Taiwo Atieno made it 3-2 from six yards out.
Hereford held on but Barnet's win at Burton meant they were relegated while Crawley took the final automatic place.
Torquay's defeat meant they slipped to fifth and they will now face Cheltenham in the play-offs. Southend - who defeated Macclesfield - finished fourth and will take on seventh-placed Crewe.
VIEWS FROM THE DRESSING ROOM
Hereford United manager Richard O'Kelly told BBC Hereford & Worcester:
"We were 3-0 up and dealt with what they had to offer. What was really pleasing was how the players stuck together, how they organised themselves, and we eventually ran out winners.
"I can't fault any of the players. They've been excellent since I walked through the door.
"My emotions are all over the shop. I'm just thinking about what's happened to the football club."
Torquay United manager Martin Ling told BBC Radio Devon:
"It was a disappointing display first half, a 3-0 scoreline was harsh on us. What we did second half was take a punt, with 4-4-2 and fresh legs and we nearly pulled off a miracle.
"It felt like watching a horror movie, because we didn't play well but everything they touched turned to gold.
"The only advantage to taking on Cheltenham in the play-offs is the distance to travel. It's a West Country derby as well as a play-off game.
"We're ready mentally now, we'll have a couple of drinks tonight because we've earned it. But as of Tuesday we'll be working towards the game at Cheltenham."