Hernandez hits two as United win at Stoke
Rooney, whose stated desire to leave Old Trafford was followed by an immediate u-turn and a five-year contract, missed the game with an ankle injury but for the second week running his replacement, Hernandez, opened the scoring.
Last week United threw away a 2-0 lead to draw 2-2 at home with West Bromwich Albion, which, after four successive away draws, was their fifth stalemate in eight league games.
It looked like a sixth was on the cards after Tuncay Sanli cancelled out Hernandez's opener in the 81st minute only for the Mexican to snatch the winner four minutes from time.
It took United's points tally to 17, level with Manchester City, who host Arsenal later on Sunday, and five behind leaders Chelsea, who beat Wolverhampton Wanderers 2-0 on Saturday.
Rooney, who turned 25 on Sunday, was reported to have flown to Dubai for a holiday while his ankle injury heals.
United anager Sir Alex Ferguson, delighted to have secured the services of his key striker for five more years - or at least guaranteed a huge transfer fee should he feel the itch again - was happy to turn his attention back to closing the gap on Chelsea.
"We have to start making up ground quickly. We can only do that with everyone on board, with no one jumping ship. Then we can see the real Manchester United," he told Sky Sports before the match.
His players were on their mettle from the start amid a cup-tie atmosphere in The Potteries with Hernandez again paired with Dimitar Berbatov up front.
Berbatov delivered his usual combination of delicate touches and somnambulic wanderings, leaving his Mexican partner to take the plaudits with a goal of which Berbatov would have been proud.
After 27 minutes Nani launched a deep cross that Nemanja Vidic headed back across goal. The ball's flight was awkward for Hernandez but he managed to leap, twist and somehow back-head the ball beyond Thomas Sorensen for an exquisite goal.
He almost got a bizarre second when he charged down a Sorensen clearance and the ball rebounded off his back and just over the bar.
United continued to stand up manfully to the physical pummelling Stoke routinely hand out to guests at the Britannia Stadium but eventually paid the price for trying to sit on their lead.
Paul Scholes passed the ball straight to Marc Wilson in midfield nine minutes from time. He immediately picked out substitute Tuncay who cut inside from the right wing and thumped a curving left-footer across Edwin van der Sar and into the top corner.
The goal shook United into life and after a Patrice Evra shot was blocked Hernandez reacted sharply to turn in the winner from close range four minutes from the end.