The Italian had been one of the pre-race favourites for the overall title, but has had to watch Chris Froome dominate proceedings along with the rest of the GC hopefuls.
On Friday, however, he produced a sterling performance on the race’s third successive day in the Alps to lift himself up from seventh to fourth in the general classification.
Nibali attacked around 60km from the finish on the ascent of the Col de la Croix de Fer, the second and the longest of the day's four categorised climbs, to catch up to early escapee Pierre Rolland (Europcar).
He chased Rolland down at the summit of the penultimate climb, the Col de Mollard, then moved clear at the foot of the final haul to the line before racing to victory on his own.
“Today, much more important was to win the stage,” said Nibali. “I wasn’t thinking about the overall standings. Today, I suffered a great deal. We’ll just see how tomorrow goes.”
It was a difficult day for Froome and Team Sky, as the Briton conceded 30 seconds to second-placed Nairo Quintana (Movistar), who broke free of the yellow jersey group 6km from the line to take second place on the day, 44 seconds behind Nibali.
Froome would cross the line in third, 30 seconds later, unable to catch up to his rival.
The result means that Froome now leads by 2:38 over Quintana heading into the weekend's two final stages.
Valverde lies third, 5:25 back, with Nibali now following in fourth, 6:44 adrift.
Several aggressive moves throughout the day from Astana, Movistar and Tinkoff-Saxo left Froome isolated, and he had only team-mate Wout Poels for company on the final climb.
That allowed Nibali to make his move, although Froome suggested afterwards the Italian had taken advantage of a bit of his own misfortune.
“There was a moment where a piece of tar got stuck between my calipers and the back wheel,” Froome said. “Almost as if someone jammed on the brakes. That was the moment Nibali chose to attack, unfortunately. I thought that was very unsportsmanlike. You certainly would not find me attacking a race like that.”
It was also a bad day for Froome supporter Geraint Thomas, whose chances of a top-five finish went up in smoke after he was distanced on the Col de la Croix de Fer.
Despite his lost time, Froome still finds himself in a very strong position heading into the final weekend, with Quintana needing to conjure up a lot more magic if he is to change the outcome of this year's race.
Stage 19 results:
1 Vincenzo Nibali (Ita) Astana Pro Team 4:22:53
2 Nairo Quintana (Col) Movistar Team 0:00:44
3 Christopher Froome (GBr) Team Sky 0:01:14
4 Thibaut Pinot (Fra) FDJ.fr 0:02:26
5 Romain Bardet (Fra) AG2R La Mondiale
6 Alejandro Valverde (Spa) Movistar Team
7 Bauke Mollema (Ned) Trek Factory Racing
8 Robert Gesink (Ned) Team LottoNL-Jumbo
9 Alberto Contador (Spa) Tinkoff-Saxo
10 Samuel Sanchez (Spa) BMC Racing Team
General classification after stage 19:
1 Christopher Froome (GBr) Team Sky 78:37:34
2 Nairo Quintana (Col) Movistar Team 0:02:38
3 Alejandro Valverde (Spa) Movistar Team 0:05:25
4 Vincenzo Nibali (Ita) Astana Pro Team 0:06:44
5 Alberto Contador (Spa) Tinkoff-Saxo 0:07:56
6 Robert Gesink (Ned) Team LottoNL-Jumbo 0:08:55
7 Mathias Frank (Swi) IAM Cycling 0:12:39
8 Bauke Mollema (Ned) Trek Factory Racing 0:13:22
9 Romain Bardet (Fra) AG2R La Mondiale 0:14:08
10 Pierre Rolland (Fra) Team Europcar 0:17:27