Three first-half goals from Delroy Facey, Harry Pell, who converted a penalty, and Rob Purdie set-up their victory.
Torquay substitute Ryan Jarvis and Tiawo Atieno scored in the 46th and 61st minutes respectively, but Hereford held out to deny the Gulls, who had already secured a play-off spot.
Hereford took the lead in the 11th minute when Facey headed a cross from skipper Purdie past goalkeeper Robert Olejnik from close range and went further ahead in the 36th minute when Pell scored from the penalty spot after Lee Mansell had brought down Purdie in the area.
Hereford's midfielder Kenny Lunt then rescued the Bulls when he headed Rene Howe's close range header off the goalline, but Purdie drilled home a low shot into the far corner to put the home side three in front going into the second half.
Torquay rallied in the second half when substitute Ryan Jarvis turned in Joe Oastler's cross and after piling on the pressure claimed a second from substitute Taiwo Atieno, who netted the Gulls' second in the 63rd minute.
Any reproduction, publication or redistribution of this material without the written agreement of 365 Media Group is strictly forbidden.