Juve appeared to be sailing through to the knockout phase as Group H winners after Ronaldo's glorious strike against his former club, but substitute Juan Mata drew the visitors level and an Alex Sandro own goal completed a remarkable finish.
United had more about them than they did when taught a footballing lesson by Juve at Old Trafford two weeks ago, though the hosts still controlled the first half and almost scored when Sami Khedira hit the post.
After Paulo Dybala hit the bar, there was to be no denying Ronaldo's sumptuous effort 25 minutes from the end, but Mata struck with a fine free-kick and then Alex Sandro bundled into his own net at the death, meaning Juve have not yet secured qualification.
United boss Jose Mourinho, formerly of Inter, subsequently taunted the Juve fans at full-time, as he walked on to the pitch and cupped his ear towards them - irritating Leonardo Bonucci in the process.
Juve went agonisingly close to the breakthrough just past the half-hour - Ronaldo picking out Khedira in the centre of the box with a cut-back, but the midfielder's first-time low shot hit the post.
The hosts were again denied by the goal's frame early in the second period, Dybala's curling 18-yard effort bouncing off the crossbar with David de Gea beaten.
Ronaldo finally ended United's resistance just past the hour, however, racing on to Bonucci's long-range pass and sending an unstoppable volley beyond De Gea after the ball dropped over his shoulder.
But things were far from over.
Mata, introduced for Ander Herrera 11 minutes from the end, equalised with a fine 20-yard free-kick shortly after coming on.
And then Alex Sandro fell victim to Ashley Young's wonderful set-piece delivery a minute from the end, as Bonucci headed the ball on to his team-mate and into the net after Marouane Fellaini and Paul Pogba had attempted to head in, United greeting the final whistle with joyous celebrations.
What does it mean? United show their mettle
No one will try to tell you United put on a show in Turin, but they were significantly better than at Old Trafford and proved their character on the biggest stage, digging deep at the end to beat arguably the tournament favourites.
The win saw United close to within two points of the Old Lady with as many games to play, and two clear of third-placed Valencia, who had beaten Young Boys earlier on Wednesday.
2 - Manchester United have come back to win a UEFA Champions League game with two goals in the final five minutes of a match for the first time since the 1999 final vs Bayern Munich. Drama. pic.twitter.com/OgN8bXdGmK— OptaJoe (@OptaJoe) November 7, 2018
The special Juan
He was only on for 11 minutes, but that was all the time Mata needed. He has been in and out of the United team, but showed his quality with the goal and use of the ball, particularly when Juve suddenly found themselves pegged back and needing to get forward.
Lingard offers little
Jesse Lingard was back in United's starting XI for the first time since September 25, but he looked well off the pace, having very little impact from his position on the right flank. The winger failed to create a single chance for his team-mates before being replaced by Marcus Rashford with 20 minutes to go.
Key Opta facts:
- The last Juventus home defeat in the Champions League group stage was in 2009-10 against Bayern Munich.
- This is only the third time Juventus have lost a home Champions League game after taking the (4-1 in 2009 against Bayern and 3-2 in 1999 against United).
- Juventus conceded their first goal of this Champions League campaign after 356 minutes, the second just 3 minutes and 30 seconds later.
- The Italian champions have hit the woodwork four times in four Champions League games this season.
- Cristiano Ronaldo has scored his first Champions League goal with Juventus with his 11th shot, this effort ending a 454-minute drought in the competition.
Juventus have another big game on the horizon, as they face AC Milan away from home on Sunday, while their next Champions League outing is at home to Valencia on November 27. United face Young Boys at Old Trafford on the same day, but before that they go into domestic outings against bitter rivals Manchester City and then Crystal Palace – the first of which takes place this Sunday - on a massive high.