Hernandez came off the bench to secure victory at Old Trafford in the last minute of normal time in Tuesday night's fourth-round tie and keep alive United's quest to become the first side to win the trophy three times in a row.
Bebe, the relatively-unknown striker signed in the summer for £7.4million from Portuguese side Vitoria de Guimaraes, crowned a promising first start with a fortunate opening goal before George Elokobi equalised.
Park Ji-Sung made it 2-1 to the home side but Kevin Foley hauled Wolves level again before Hernandez's excellent finish took United into Saturday's quarter-final draw.
Sir Alex Ferguson made 11 changes and Wolves boss Mick McCarthy seven, and the first half in a quiet Old Trafford, with plenty of empty seats, was a dismal affair.
United's striker Gabriel Obertan and Federico Macheda were poor, the best chance coming when Macheda sent a shot straight at Wolves goalkeeper Wayne Hennessey after Bebe's scuffed centre ended up at his feet.
The second half opened with more apparent problems for United as Matt Jarvis rampaged down the right and sent over a ball to the far post that Steven Fletcher met with a cracking left-foot volley which went wide.
Darron Gibson gave United encouragement with a swerving free-kick that was on target, the only problem being that it swerved straight into Hennessey's arms.
Park looked certain to score when Michael Carrick feigned to shoot and instead played a delicious pass to set the Korean free but Hennessey pulled off a stunning block.
It finally needed a touch of fortune - and an excellent decision by assistant referee Darren Cann - to see United take the lead.
Bebe did well to muscle past Elokobi but his deflected cross went right over the Wolves keeper and dropped over the line. Foley thought he had headed the ball off the line but Cann waved his flag for a goal, and TV replays showed the World Cup final linesman had judged it perfectly.
No sooner had United taken the lead then Wolves equalised. Fabio's brilliant block
denied Stephen Hunt but from the corner Elokobi rose superbly and thumped a header into the goal.
Macheda, of whom so much was expected, continued to disappoint when he hooked over from Bebe's astute pass - he should have scored.
Despite that miss the goals kept coming, first when Park put United 2-1 up. It was his driving run that took the ball into the heart of Wolves territory and it came back to him somewhat fortuitously after Macheda lost control, and Park placed the ball neatly into the corner of the net.
Once more however Wolves came back with a nice build-up involving Sylvan Ebanks-Blake and a flick from Fletcher to set up Foley who fired through Jonny Evans' legs past Ben Amos.
It could have been worse for United when Ebanks-Blake sidestepped Chris Smalling and hammered a terrific shot with a minimum of backlift only to see it skim past the upright.
With extra-time approaching Ferguson took off the tired-looking Bebe, and sent on the weekend's goalscoring hero Hernandez.
The young Mexican was immediately influential, sending Obertan sprinting in on goal but his finish was once again disappointing, flashed wide with only the keeper to beat.
Hernandez's class finally made the difference in the very last minute of normal time when he left two Wolves defenders in a heap and lifted the ball coolly over Hennessey.