Managerless Bristol Rovers ended a run of five successive defeats by beating Hereford, who remain a point clear of the League Two relegation zone.
Eliot Richards went close for the visitors before Lee Brown drilled his shot past Adam Bartlett into the far corner of the net.
Delroy Facey levelled when he latched on to Benoit Dalibard's through ball.
Dalibard was sent off for a dangerous foul on Richards and substitute Scott McGleish headed in the winner.
VIEWS FROM THE DRESSING ROOM
Bristol Rovers caretaker manager Shaun North told BBC Radio Bristol:
"It's important to keep the ball as we saw on Saturday in the Cup game where they made us run and run - and we did that well tonight.
"It's a massive three points given our situation.
"They are a team that are in and around us and we have to start picking up points at those teams."