Table-topping MK Dons maintained their position at the head of League Two as they extended their remarkable run to nine victories.
But they left it late with Mark Wright's decisive goal coming just three minutes from the end.
That was tough on Hereford who had kept the Dons attack in check despite playing the second 45 minutes with only ten men after Steve Guinan was sent off in first-half injury time.
Hereford had the better of the early play and could have taken the lead after 15 minutes.
Guinan's cross was knocked on by Theo Robinson to John McCombe, whose flicked header was well clawed away by goalkeeper Willy Gueret.
Robinson had the ball in the net seven minutes later when he rifled in the rebound after Gueret had pushed out Ben Smith's shot, but the offside flag was up.
After this, the Dons had the better of the remainder of the half and Drissa Diallo might well have put the visitors ahead when he lashed a 28th minute shot across goal and wide following Dean Lewington's free-kick.
Leon Knight then volleyed just wide before Guinan saw red in injury time.
The striker lost possession in midfield and chased back to try to retrieve his error, but only succeeded in scything down Lloyd Dyer from behind. The straight red card was immediately produced by referee Paul Melin.
Knight should have opened the scoring on 51 minutes when he somehow contrived to screw Dyer's cross wide of the target from a yard out.
But after that, although unsurprisingly the balance of the play was with the visitors, Hereford's defence, in which McCombe excelled, dealt well with any threat.
After 87 minutes, however, Keith Andrews' chip forward was flicked on by Aaron Wilbraham and the ball fell to the unmarked Wright, who rifled an unstoppable shot past Bulls keeper Wayne Brown to settle the issue.