Late goals by Eric Lichaj and Nathan Delfouneso helped Aston Villa see off a determined Hereford side and reach the third round of the Carling Cup.
David Cornell made a string of saves to keep Villa at bay, denying Stephen Ireland when he ran through and keeping out Darren Bent's far-post header.
But Lichaj broke the deadlock when the Bulls could not clear a Marc Albrighton corner with 10 minutes left.
Delfouneso sealed victory when he swept home Andreas Weimann's knockdown.
Villa boss Alex McLeish, who won this competition with Birmingham last season, had rested many of his first-choice line-up but retained Richard Dunne, Charles N'Zogbia and Bent from the side that beat Blackburn on Saturday.
McLeish's men dominated possession from the start but found it far harder than expected to see off the Bulls, who are second-bottom of League Two with only one point from their first four games.
Much of that was down to Cornell, a Welsh Under-21 international on loan from Swansea, but Hereford's whole defence kept clear openings to a minimum.
Ireland should have given Villa the lead when he latched on to Barry Bannan's pass but he could not convert despite being given a second chance when Cornell fumbled his first effort.
Cornell denied Bent and Albrighton either side of the break, before his best save of the night saw him tip N'Zogbia's 25-yard effort over the bar.
Hereford began to threaten themselves with Joe Colbeck testing Brad Guzan.
But Villa finally forced the opener when Lichaj was in the right place to convert following a goalmouth scramble, and substitute Delfouneso's close-range strike put the result beyond doubt.