Kobbie Mainoo scored a sensational 97th-minute winner for Manchester United after Wolves themselves had levelled in stoppage time in a stunning 4-3 game at Molineux.
Marcus Rashford, restored to the team, opened the scoring and Rasmus Hojlund doubled the lead before the break with United dominant but the drama had hardly begun.
Pablo Sarabia pulled one back from the spot before another substitute, Scott McTominay restored the two-goal advantage. Max Kilman's late goal offered Wolves hope and Pedro Neto thought he had secured a point before Mainoo's magnificent winner.
It was a breathless contest to ultimately delight the visiting Manchester United support, although even the crestfallen home team were applauded from the pitch.
Wolves had not lost at home since being beaten by Liverpool in September and could have moved above United with victory. Instead, they remain 11th in the table while Ten Hag's team are up to seventh.
- How the teams lined up | Match stats
- Live Premier League table | Fixtures | Results
- Watch free Premier League highlights
- Stream Sky Sports with NOW | Get Sky Sports
How Man Utd won Molineux thriller
Ten Hag said before kick-off that this might be Manchester United's strongest side and things would look different once the injured players had returned and they played as if that were true during the opening period, scoring before Wolves had really had a kick.
Hojlund laid the ball off to Rashford and the returning favourite caressed the ball beyond Jose Sa and into the corner of the net. It oozed cool and made a mockery of the fuss that has surrounded him all week. United just seemed to grow in confidence thereafter.
Wolves were tactically undone for the second goal, Neto failing to track the powerful off-the-ball run of Luke Shaw and when Rashford slipped him in, the full-back's low cross was bundled into the net by Hojlund after earlier ricocheting off Craig Dawson and Sa.
Hojlund almost had another when Matt Doherty's under-hit pass to the goalkeeper resulted in the clearance cannoning off him but just wide. The Denmark forward was then denied when a narrow offside decision went against him after tucking the ball away late in the first half.
Casemiro, booked early on but otherwise restoring control to United's midfield, found the net with a header before that half was through but was again offside and the onus was on O'Neil to change things at the break. The tone of the game certainly shifted.
Kilman had a header cleared from near the line by Lisandro Martinez, making his first Premier League start since September. Hojlund then spurned a good chance after an error by Toti Gomes. But the penalty offered Wolves a route back into it.
The decision to award the spot-kick was soft, Casemiro barely connecting with Neto - if at all. But Sarabia, on as a substitute, converted and the crowd were in the game. United struck again. McTominay did not even have to jump to nod in United's third from a corner.
Again, Wolves fought back. They showed real spirit in the second half, defending that long unbeaten run at home. Dawson's miscued shot was turned in by Kilman to set up a big finish. Neto delivered it when United inexplicably allowed a counter-attack.
His shot appeared to wrong-foot Andre Onana and Molineux was wild, dreaming of an unlikely winner of their own. But, amid a raucous atmosphere, it was Mainoo who was calm while others were not, skipping away from two before curling effortlessly into the corner.
It was a goal that will be talked about for years, the biggest moment of his fledgling career to date - and a big moment for his manager and team. Had United let this slip, it would have been damning. But this was a night to remember for the right reasons, instead.
Man Utd's dramatic win in stats
- Manchester United have won three of their first four matches in 2024 in all competitions after ending 2023 with just two wins in nine.
- Wolves suffered their first home Premier League defeat since losing 3-1 to Liverpool in September, ending a run of eight successive unbeaten games at Molineux.
- Rasmus Hojlund has now both scored and assisted in each of his last two Premier League appearances.
- Manchester United have conceded two or more goals in five consecutive league games for the first time since November 1977.
Ten Hag's mixed feelings after dramatic win
"To be honest, I have mixed feelings," said Ten Hag. "For the neutral, for the spectator, it is great to see. But as a manager, when you have dominated for an hour and should be three or four up, the way we concede the goals, we should manage it better, it cannot happen."
But Mainoo saved the day. "He is making incredible progress," Ten Hag had told TNT Sports. "He has great abilities. He is the modern midfield player. He can attack and he can defend. He has the intelligence and the physicality, and he is also composed."
O'Neil proud but disappointed by details
"Incredibly proud of some of what we produced, the resilience, the togetherness, the quality, there were large spells when we looked close to being an excellent team," said the Wolves boss. "There were little bits that we need to improve, obviously."
He added: "The two goals in the second half, very disappointing as it is down to detail. The throw-in at the end is not how we defend throw-ins.
"You are tested in the Premier League, the emotion of it. We go completely off plan [after Rashford's early goal] and start opening up big spaces. But in terms of the togetherness, the work ethic, I thought second half, we were by far the better side."
Neville: Mainoo has the world at his feet
Sky Sports' Gary Neville:
"I was a part of those games when you've given a goal away at one end and somehow one of your special players would do something special and the goal was sensational by Mainoo. We've seen different types of goals but for him to keep such composure and put the ball in between someone's legs and the finish!
"He's a fantastic player. I think to come into Man Utd team in any team is very difficult and he's come into the team in one of the club's most difficult times in recent history and he's just stood out as being someone whose temperament and composure is off the scale.
"He's got the world at his feet for the next few years and there's been an example where you can get carried away: Marcus Rashford had the same. But he's got 15 years coming up, Mainoo, where he's got to keep feet on the ground. But he's got all the attributes that you would need to be a top player."
What's next?
Manchester United host West Ham on Super Sunday, live on Sky Sports; kick-off 2pm.
Wolves travel to Chelsea, also on Sunday; kick-off 2pm.