Britain's Simon Yates is up to second overall in the Giro d'Italia after Kasper Asgreen won stage 14 on a day when a crash had a major impact on the general classification battle.
Asgreen held on for a remarkable breakaway win, while race leader Isaac del Toro survived to extend his lead to one minute and 20 seconds over Yates.
A bunch sprint was expected in Nova Gorica/Gorizia on the Italy-Slovenia border but several riders went down 23km from the line to set up a dramatic finish.
The crash split the peloton, with about 20 riders avoiding the chaos to keep up the chase of the breakaway trio.
But they could not reel in Asgreen as Denmark's EF Education-EasyPost rider, 30, claimed his second Grand Tour stage win by 16 seconds.
Alpecin-Deceuninck's Kaden Groves outsprinted Visma-Lease a Bike rider Olav Kooij to take second place.
Del Toro was in the chase group and so retained the pink jersey, but only after the 21-year-old survived another scare towards the end of the 195km route from Treviso.
Several of the Mexican's GC rivals lost further time, though, including Juan Ayuso, Antonio Tiberi and Primoz Roglic.
The UAE Team Emirates rider's lead stretched from 38 seconds, with Visma-Lease a Bike rider Yates going second and Ayuso now third.
Asgreen was in a breakaway group with Mirco Maestri and fellow Italian rider Martin Marcellusi as they began two laps of the finishing circuit around Nova Gorica/Gorizia.
Some rain had fallen and as the peloton approached a narrow road on a cobbled sector, several riders went down, bringing the rest of the peloton to a halt.
Italian hope Giulio Ciccone was the biggest casualty initially as he was clearly in discomfort and only managed to keep riding at the second attempt, leaving him more than five minutes adrift.
It gradually became apparent that Ayuso, Roglic, Mads Pedersen and Egan Bernal were missing from the front of the peloton and were in the process of damage limitation.
At the same spot on the following lap, Del Toro's back wheel slipped on the cobbles but he somehow managed to stay upright.
The Alpecin-Deceuninck and Visma-Lease a Bike riders then led the chase but Asgreen, 30, proved too strong.
"It was a tough day out there," said Asgreen. "It's annoying that you have to destroy yourself completely like this to win but when it works out it's all worth it.
"The team gave me permission and the freedom to go for it and I'm super grateful for that."
K Asgreen (Den/EF Education-EasyPost) 4hrs 4mins 40secs
K Groves (Aus/Alpecin-Deceuninck) +16secs
O Kooij (Ned/Visma-Lease a Bike) Same time
O Aular (Ven/Movistar) "
S Oldani (Ita/Cofidis) "
M Maestri (Ita/Polti VisitMalta) "
D Gee (Can/Israel-Premier Tech) "
T Pidcock (GB/Q36.5 Pro Cycling) "
R Carapaz (Ecu/EF Education-EasyPost) "
M Honore (Den/EF Education-EasyPost) "