Santa Maria di Sala - Italy's Damiano Cima of the Nippo team snatched victory with a sprint finish, holding off a late charge in Thursday's 18th stage of the Giro d'Italia as Ecuador's Richard Carapaz tightened his grip on the leader's pink jersey with three days left.
Cima had been part of a long range breakaway and edged Germany's Pascal Ackermann, who headed up the charging peloton, on the line after nearly five hours in the saddle, with Italy's Simone Consonni, third for UAE-Emirates.
A clearly frustrated Ackermann could later console himself after regaining the sprint points jersey at the expense of France's Arnaud Demare, the big loser of the day, while Cima was left in a state of euphoria.
"I can't believe what just happened. I've spent so many kilometres in breakaways during this Giro. I thought I'd never make it, but I've won today," said the rider from Brescia, whose only previous win was a stage in the Tour of China last year.
"It's insane, the dream of a lifetime."
There was no change among the top three with Movistar's Carapaz holding his 1:54 advantage over Italy's former two-time winner Vincenzo Nibali, with Slovenian Primoz Roglic third at 2:16.
"The important thing is that I finished again with good feelings and without any damage or mishap for anyone on the team," said Carapaz.
"Tomorrow is different: it is another contact with the mountains, another test for us, the three days will be equally crucial.
"We feel very prepared in the team and, above all, with the confidence that we can do things well," he warned.
It was an eventful stage which got underway in Valdaora in the Dolomites.
Cima formed a three-man breakaway after 50km along with Mirco Maestri and Nico Denz, building up a maximum advantage of four and a half minutes on the pink jersey group.
The 222km stage gave the remaining sprinters a final chance as the route dropped to sea level, through the Venetian hinterlands to Santa Maria di Sala, concluding with a 2km sprint for the line.
Demare lost out in the final sprint having led Ackermann in the intermediary sprint.
The Groupama-FDJ rider finished eighth losing all hope of reclaiming the points jersey from Bora–Hansgrohe's Ackermann.
"We had all the cards in our hands and we lost everything," said Demare's frustrated team sporting director Frederic Guesdon.
"We got too greedy."
Demare's team-mates had helped Ackermann's team in the final two kilometres, by leading the pack, with double consequences, as the French rider was left alone in his sprint and condemned the breakaway except for Cima, the only one to resist.
"We wanted to be well placed for the sprint but it did not go the way I wanted," said Demare.
"I was impeded twice."
Friday's 19th stage returns to the mountains with a 151km run between Treviso and San Martino di Castrozza, concluding with a final 13.6km climb with a 5.6 percent gradient, on the eve of the big stage in the Dolomites.
Leader Carapaz remains unworried of a repeat of last year when Britain's Chris Froome obliterated his rivals with two stages remaining, to take the pink jersey with a stunning stage 19th victory.
"No Giro is identical to the other and, this year, the mountain is not the same. It will be hard, not only for me, but for others too."
Results after Thursday's 18th stage of the Giro d'Italia over 222km from Valdaora à Santa Maria di Sala:
1. Damiano Cima (ITA/Nippo) 4hr 56min 04sec (average: 44.9 km/h), 2. Pascal Ackermann (GER/BOR) s.t., 3. Simone Consonni (ITA/UAE) s.t., 4. Florian Sénéchal (FRA/DEC) s.t., 5. Ryan Gibbons (RSA/DDT) s.t., 6. Manuel Belletti (ITA/AND) s.t., 7. Davide Cimolai (ITA/ICA) s.t., 8. Arnaud Demare (FRA/FDJ) s.t., 9. Sean Bennett (USA/EF1) s.t., 10. Mirco Maestri (ITA/BAR) s.t., 11. Nico Denz (GER/ALM) s.t.
33. Vincenzo Nibali (ITA/BAH) s.t., 35. Primož Roglic (SLO) s.t.,. 42. Richard Carapaz (ECU/MOV) s.t. 46. Mikel Landa (ESP) s.t, 49. Simon Yates (GBR) s.t.
1. Richard Carapaz (ECU/Movistar) 79hr 44min 22sec, 2. Vincenzo Nibali (ITA/BAH) at 1min 54sec, 3. Primoz Roglic (SLO/JUM) 2:16, 4. Mikel Landa (ESP/MOV) 3:03, 5. Bauke Mollema (NED/TRE) 5:07, 6. Miguel Angel Lopez (COL/AST) 6:17, 7. Rafal Majka (POL/BOR) 6:48, 8. Simon Yates (GBR/MIT) 7:13, 9. Pavel Sivakov (RUS/INE) 8:21, 10. Davide Formolo (ITA/BOR) 8:59, 11. Jan Polanc (SLO/UAE) 9:20, 12. Ilnur Zakarin (RUS/KAT) 10:32, 13. Hugh Carthy (GBR/EF1) 14:51, 14. Joe Dombrowski (USA/EF1) 15:44, 15. Valentin Madouas (FRA/FDJ) 19:45
27. Bob Jungels (LUX/DEC) 50:23, 39. Esteban Chaves (COL/MIT) 1 h 13:58, 55. Nans Peters (FRA/ALM) 1 h 40:34, 127. Arnaud Démare (FRA/FDJ) 4 h 04:47, 143. Sho Hatsuyama (JPN/NIP) 5 h 03:51.