Vasil Kiryienka won the 19th stage by over four minutes
Alberto Contador's Giro d'Italia lead was cut to just four seconds after he finished more than six minutes behind the winner of the 19th stage.
The Spaniard, who led by more than a minute going into the mountain stage, will face competition from Italian Riccardo Ricco over the final two days.
Belarussian Vasil Kiryienka won Friday's stage, coming home in six hours, 37 minutes and 32 seconds.
Danilo Di Luca was second while Briton Steven Cummings claimed fourth place.
"The stage was much longer than it said in the race manual and my team worked really hard to help me defend the race lead," said Contador.
"I have to say well done to Di Luca and Ricco, they made a good attack. The Giro is going to be interesting now but I'm not scared of anybody.
"I came to the Giro with a plan and I'm not going to get obsessed about Ricco and Di Luca."
Saturday's 224 kilometres 20th stage from Rovetta to Tirano is the final mountain stage.
The three-week race ends on Sunday with a 28.5 kms individual time trial.
Stage 19 results:
Vasil Kiryienka, Belarus, Tinkoff Credit Systems, 6:37.32
Danilo Di Luca, Italy, LPR Brakes, +4:36
Alexander Efimkin, Russia, Quick Step, +4:43 behind
Steven Cummings, England, Barloworld, +5:25
Riccardo Ricco, Italy, Saunier Duval, +5:44
Emanuele Sella, Italy, CSF-Navigare, +6:21
Franco Pellizotti, Italy, Liquigas, same time
Jurgen Van Den Broeck, Belgium, Silence-Lotto, same time
Marzio Bruseghin, Italy, Lampre, same time
Denis Menchov, Russia, Rabobank, same time
Domenico Pozzovivo, Italy, CSF-Navigare, same time
Alberto Contador, Spain, Astana, same time
Overall Standings (After 19 of 21 stages):
Alberto Contador, Spain, 82:29.10
Riccardo Ricco, Italy, +4secs
Danilo Di Luca, Italy, +21
Marzio Bruseghin, Italy, +2:00
Franco Pellizotti, Italy, +2:05
Denis Menchov, Russia, +2:47
Emanuele Sella, Italy, +4:25
Jurgen van den Broeck, Belgium, +4:26
Domenico Pozzovivo, Italy, +5:25
Gilberto Simoni, Italy, +7:18