Chris Froome was penalised 20 seconds for taking food in the final 5km of stage 18 but still extended his lead in the Tour de France by 37 seconds.
With Froome struggling on the second climb of the Alpe d'Huez, his team-mate Richie Porte dropped back to the team car to get an energy bar for Froome.
Porte broke the rules, but Froome was also docked time by race commissaires.
France's Christophe Riblon won the showpiece 18th stage for the first home win of this year's race.
Despite a rare sign of weakness, Froome finished 57 seconds ahead of second-placed Alberto Contador and, even after his time penalty, extended his overall lead over the Spaniard to five minutes 11 seconds.
"Chris Froome will accept his 20-second penalty because, if he had not taken on board the extra energy, he would have lost more time than that.
"But if this was his bad day, then he will definitely take the outcome. He was not at the top of his game but, if he had not run out of energy so suddenly on that second ascent, he probably would have stayed with Nairo Quintana and Joaquim Rodriguez too.
"It did not matter too much in the end, but it was a bit of a lapse to have been caught out by not taking on enough food before the last climb.
"It was another thrilling day of racing, and we are almost taking that for granted now.
"Alberto Contador attacked on the descent of Col de Sarenne, but Froome did the right thing in letting him go and concentrating on getting down safely, because he was so confident of catching him, and he ended up doing far more than that.
"Froome has a cushion of more than five minutes now but he still has to get through Friday's stage safely. The Glandon and the Madeleine are two of the toughest climbs on the Tour and they are early on in the stage too.
"If Froome is attacked and isolated again, then he has got an awful lot of flat valley roads between the other mountains, which will make it very difficult for him to control any further attacks. It could be a tough day for him, and for Team Sky."
The Tour marked its 100th edition by climbing the iconic Alpe twice in the same day for the first time in its history.
Froome attacked and dropped Contador at the start of his second ascent of a mountain steeped in Tour history, but needed help from Porte after running out of energy before reaching the end of the climb through the Alpe's famous 21 switchbacks.
"It was a difficult stage," Froome said. "When I signalled for help, I needed sugar and I was thankful that Richie was there."
Colombia's Nairo Quintana attacked as Froome refuelled, and finished one minute six seconds ahead of him, enough for the Tour debutant to move third overall, just 21 seconds behind Contador.
"I still haven't won a stage yet but I am very happy with my performance," said Quintana, who tightened his grip on the white jersey, for the best-placed rider aged 25 or under.
By the time the race reached the Alpe for the first time, Froome had already come under pressure from Contador's Saxo Tinkoff team-mates, who set a furious pace in the first hour of the 172.5km stage.
Froome was briefly isolated from his Team Sky team-mates but kept his cool and also remained calm when Contador attacked on the descent of Col de Sarenne, the twisting mountain pass which linked the two ascents of the Alpe.
Contador pulled 20 seconds clear of Froome at one point, but was caught after a bike change before reaching the bottom of the Alpe for the second time.
As the riders battled up the Alpe again, through hundreds of thousands of fans, Froome launched his attack and Contador could not respond.
At that point, Froome looked as strong as he did when he won the previous two mountain-top finishes on this year's Tour, at
Ax 3 Domaines
but this time he could not stay with Quintana or Joaquim Rodriguez.
Ahead of them, the last three survivors of a nine-strong break that escaped early in the day were battling it out for the accolade of a stage win on top of the Alpe.
Riblon, who crashed into a stream on his way down Col de Sarenne, took the honours, overhauling a tiring Tejay van Garderen with the American less than 2km from the finish.
"To raise my arms aloft at L'Alpe d'Huez is incredible,'' Riblon said. "With five kilometres to go, I thought I had lost it.''
Froome has just 447km (277 miles) of the Tour's total distance of 3,404km (2,115 miles) between him and the finish line on the Champs-Elysees on Sunday, but he must survive two more days in the high mountains of the Alps before the procession into Paris.
Friday's stage sees the riders go up four more tough climbs - including the Col du Glandon and Col de la Madeleine - as part of a 204km (129-mile) route from Le Bourg-d'Oisans to Le Grand-Bornand.
"It is possibly the toughest day of the Tour de France," said Froome.
Results of stage 18:
1. Christophe Riblon (France/AG2R) 4:51:32"
2. Tejay van Garderen (U.S./BMC Racing) +59"
3. Moreno Moser (Italy/Cannondale) +1:27"
4. Nairo Quintana (Colombia/Movistar) +2:12"
5. Joaquim Rodriguez (Spain/Katusha) +2:15"
6. Richie Porte (Australia/Team Sky) +3:18"
7. Chris Froome (Britain/Team Sky) +3:18"
8. Alejandro Valverde (Spain/Movistar) +3:22"
9. Mikel Nieve (Spain/Euskaltel) +4:15"
10. Jakob Fuglsang (Denmark/Astana) +4:15"
11. Alberto Contador (Spain/Saxo - Tinkoff) +4:15"
12. Roman Kreuziger (Czech Republic/Saxo - Tinkoff) +4:31"
Overall standings after stage 18:
1. Chris Froome (Britain/Team Sky) 71:02:19"
2. Alberto Contador (Spain/Saxo-Tinkoff) +5:11"
3. Nairo Quintana (Colombia/Movistar) +5:32"
4. Roman Kreuziger (Czech Republic/Saxo-Tinkoff) +5:44"
5. Joaquim Rodriguez (Spain/Katusha) +5:58"