Floyd Landis produced an incredible comeback a day after saying he had lost the Tour de France, to claim the last mountain stage of the race from Saint-Jean de Maurienne to Morzine.
The Phonak rider, who cracked on Wednesday's Alpine stage, crossed the line five minutes and 42 seconds ahead of Spaniard Carlos Sastre (CSC).
Oscar Pereiro finished seventh 7:08 off the pace and retained the yellow jersey with a lead of 12 seconds over Sastre.
Landis, having climbed four daunting passes in five hours 23 minutes and 36 seconds at an average speed of 37.18 kph, cut his deficit from 8:08 to 30 seconds.
"Yesterday [Wednesday], I had a bad day. I was very disappointed because my team had worked well," the 30-year-old told reporters.
"I had to make up for it, I had to show I deserved to be a leader."
Asked about his chances of winning the Tour for the first time, Landis answered: "I'm very confident in my time trialing ability but I just have to wait and see."
After a transitional 18th stage from Morzine to Macon, a 57-km time trial will decide the winner of the Tour on the eve of Sunday's last parade on the Champs-Elysees.
Landis is regarded as the best time trial specialist of the overall top three and defeated Sastre and Pereiro by 1:10 and 1:40 respectively in the first stage against the clock.
"Landis did a sensational stage and deserves congratulations," Sastre said.
"He went like an eagle on the first climb and against that you can't do anything."
On Thursday, the third consecutive day of high mountain climbing in the Alps, 11 riders broke away soon after the start of the 200.5-km 17th stage.
The shock attack, however, came 73 km into the race when Landis destroyed the peloton on the opening climb, the first category Col des Saisies.
Following Wednesday's disappointment, Landis had written off his chances of the overall victory saying: "I don't expect to win this Tour anymore. It's never easy to get back eight minutes but I'll keep fighting till the end and try."
True to his word, the former lieutenant turned rival of seven-times champion Lance Armstrong, launched a brave and solitary challenge to his adversaries and maybe to himself on the long and hot climb.
At the summit, the American was two minutes and 57 seconds behind Frenchman Patrice Halgand, who was the first to dive over. The main bunch, led by Pereiro, was 6:03 behind the leaders.
In an amazing ride, Landis caught most of the leading group, except Halgand, in the valley between the Col des Saisies and the second category climb, Col des Aravis.
Over the top, Halgand's lead on Landis was down to 1:12 and with 76 km to go, the Frenchman was caught.
Landis led with German Patrik Sinkewitz, Italian Daniele Righi (LAM), Australian Stuart O'Grady and Halgand.
Approaching the first-category Col de la Colombiere, the Phonak rider suffered a puncture on his rear wheel but he went straight back to the front on a spare bike.
Righi, Halgand and O'Grady gave up on the slopes and Landis was first at the top with Sinkewitz just behind him.
The hors-category Joux-Plane, a monster of a col with an altitude gain of about 990 metres and a maximum gradient of 10.5 percent, loomed.
Landis dropped Sinkewitz and dived into the sharp and tricky 12-km descent to Morzine.