After a relatively uneventful first 190km of the 222km queen stage, Dumoulin suffered stomach problems on the run-in to the final climb, and was forced to make an emergency stop at the side of the road for a natural break.
While the Dutchman was throwing off his helmet and pink jersey and running down a bank at the side of the road, Ilnur Zakain (Katusha-Alpecin) attacked from the group containing the other GC contenders.
Dumoulin wasn't off his bike for long, but the pattern had been set in the main group, as Bahrain-Merida and Movistar decided not to wait for the race leader, pushing the pace while the pink jersey fought behind.
The Team Sunweb rider had an advantage of 2-41 at the top of GC at the start of the day, which looked safe for most of the climb, before Nibali and Nairo Quintana (Movistar) attacked near the top of the Umbrail Pass.
They crested the climb with 20km remaining with lead of 2-10, as Nibali pushed on to catch Mikel Landa (Team Sky), the last survivor of a group of early escapees, on the descent.
After riding solo for much of the final climb Dumoulin was clearly exhausted, looking lacklustre when pedalling on the descent while Nibali sprinted out of hairpins to catch Landa and drop Quintana.
That meant it was down to Nibali and Landa to contest the stage win, with Nibali proving the fastest in the final 100m to take the stage win.
Quintana crossed the line 12 seconds later, before the clock started ticking for the pink jersey.
Still alone, Dumoulin produced a courageous ride on the lower part of the descent to limit his losses, and eventually finished just over two minutes behind Quintana to hold on to the overall lead by 31 seconds.
How it happened
The 16th stage of the Giro d'Italia began in a sombre mood, with the peloton taking a moment of silence to reflect on the overnight bombing in Manchester, and the deaths of motorcyclist Nicky Hayden and triathlete Julia Viellehner in separate cycling crashes in eastern Italy.
Once the racing was underway, it proceeded in a similar fast and furious fashion to what was seen on stage 15, with an average speed of 50kmh for the first hour of racing as the peloton was reluctant to let a break get away.
When a move finally established itself it consisted of 27 riders who pulled out a maximum gap of a minute, but with Vincenzo Nibali's Bahrain-Merida not present they were brought back by the lower slopes of the Passo del Motirolo.
The start of the climb saw the chance for another move to establish itself, with 25 riders going clear: Pello Bilbao and Luis Leon Sanchez (Astana), Manuel Senni (BMC Racing), Pierre Rolland, Michael Woods and Joe Dombrowski (Cannondale-Drapac), José Mendes (Bora-Hansgrohe), Jan Hirt and Felix Grosschartner (CCC Sprandi Polkowice), Alexander Foliforov (Gazprom-Rusvelo), Andrey Amador, José Herrada, and Gorka Izagirre (Movistar), Laurens De Plus (Quick-Step Floors), Igor Anton, Natnael Berhane, and blue jersey wearer Omar Fraile (Dimension Data), Steven Kruijswijk (LottoNL-Jumbo), Mikel Landa, Philip Deignan, Sebastian Henao, and Vasil Kiryienka (Team Sky), Laurens Ten Dam (Team Sunweb), and Rui Costa and Edward Ravasi (UAE Team Emirates) .
Climbing the Motirolo from the "easier" side, Sanchez set a fierce pace up the climb, extending the break's advantage to 1-30 by the summit.
The first rider across the line at the top would also be awarded the Cima Scarponi, a special prize awarded by the race organiser's in memory of the late Michele Scarponi, and despite being in the break to chase mountains points, Omar Fraile performed a gentlemanly gesture as he let Sanchez, a friend and team-mate of Scarponi at Astana, lead the race over the top of the Motirolo.
In the peloton it was up to Sunweb to control the descent, with Chad Haga and Simon Geschke leading Dumoulin down the narrow road, before 25km of wider valley roads as the race made its way towards the first of two ascents of the Stelvio.
With 101km to go the race crossed the finish line for the first time, by which time the break's advantage was nearly three minutes, an increase in their lead which was entirely down to the hard work of Kiryienka on the front.
Kiryienka continued to lead for the first half of the Stelvio, dropping a number of riders from the break in the process, before Deignan took over on the front of the break.
In the peloton the chase was taken up by Trek-Segafredo and FDJ, who raised the pace considerably to drop all of the Sunweb domestiques and leaving Dumoulin isolated.
By the top of the climb the front group was down to just eight riders in Deignan, Landa, Anton, Sanchez, Anacona, Izagirre, Amador, Kruiswijk, and Hirt. Landa led them over the top of the Stelvio, taking the Cima Coppi prize for the first rider over the Giro's highest point. The peloton, down to about 15 riders, was 2-32 further back.
The descent down to the valley floor was a spectacular one, with 48 hairpin bends to be tackled on the way down, and Amador took maximum advantage of its technical nature as he opened a gap on the rest of the leaders.
The Costa Rican was joined midway down the descent by Mikel Landa, and the duo began to work well together as they made their way towards the final climb of the day, the Umbrail Pass, with a 20 second lead over the chasers and two minutes over the pink jersey group.
However that lead didn't last long as Kruiswijk dragged the chasing group across, meaning a seven-strong group of Kruiswijk, Anacona, Amador, Hirt, Deignan, Landa, and Anton at the front of the race.
With 34km remaining the next attack came from Kruiswijk, which elicited a reaction from Landa and Hirt, but there was a moment of panic for Dumoulin who seemed to be suffering from stomach trouble as he pulled up at the side of the road for a natural break.
The pink jersey was back on his bike in within a minute, but seemed to struggle as tried to make his way back to the leaders.
However there was no waiting for Dumoulin as Zakarin briefly attacked before Nibali sent Bahrain-Merida team-mate Franco Pellizotti to the front to raise the pace.
Dumoulin was visibly struggling as he found himself 1-30 back from the group containing Quintana, which was now being pushed on by Movistar who had called Amador back from the break, leaving Landa to go solo ahead.
For a few minutes the Dutch race leader seemed to be recovering, but with 25km to go Vincenzo Nibali attacked with Quintana, Pozzovivo, and Zakarin, dropping Yates, Jungels, and Pinot.
From there the gap kept going out, and with 20km remaining Nibali unleashed another savage attack which only Quintana was able to follow at first before Zakarin and Pozzovivo clawed their way back on
Up ahead, Landa's lead was down to 13 seconds by the top of the Umbrail Pass, with the chasing quartet in hot pursuit, but Dumoulin in real trouble at 2-19 back.
From there all that was left was a fast descent to the finish in Bormio, which was perfect territory for Nibali to lead the chase after Landa, while Dumoulin was all alone more than two minutes behind.
Nibali was really pushing on, even bunny-hopping over a patch of water going in to one corner, and with 12km to go caught Landa.
>>> 'The race was on, we couldn't wait for him' say Tom Dumoulin's Giro d'Italia rivals
Landa latched on to the wheel of the flying Italian, but Quintana found himself a little further back and on his own as he fought not only to catch the leaders, but also to extend the gap back to Dumoulin.
The pink jersey was also alone, and the gap to the leaders was out towards three minutes, meaning that Dumoulin was about to lose the race lead.
As the road flattened out on the outskirts of Bormio it was Landa who led under the flamme rouge with Nibali in his wheel, the Bahrain-Merida rider looking to take Italy's first win of the race.
The Spaniard led through the technical final kilometre, but Nibali had more in his legs coming around the final corner, edging out Landa for the win.
Quintana crossed the line 12 seconds back, and then the wait was on for Dumoulin to arrive.
The clocked ticked on towards two minutes as a group of chasers were led across the line by Bauke Mollema and Bob Jungels, but there wasn't much longer to wait for Dumoulin, who eventually came home 2-18 behind Nibali to hold on to pink by 31 seconds.
Giro d'Italia stage 16: Rovetta to Bormio (222km)
1. Vincenzo Nibali (Ita) Bahrain-Merida 6:24:22
2. Mikel Landa (Esp) Team Sky, at same time
3. Nairo Quintana (Col) Movistar Team, at 12 secs
4. Domenico Pozzovivo (Ita) AG2R La Mondiale, at 24 secs
5. Ilnur Zakarin (Rus) Katusha-Alpecin, at 32 secs
6. Davide Formolo (Ita) Cannondale-Drapac, at 1-26
7. Bauke Mollema (Ned) Trek-Segafredo, at 1-35
8. Bob Jungels (Lux) Quick-Step Floors
9. Adam Yates (GBr) Orica-Scott
10. Thibaut Pinot (Fra) FDJ, all at same time
13. Tom Dumoulin (Ned) Team Sunweb, at 2-18
General classification after stage 16
1. Tom Dumoulin (Ned) Team Sunweb, in 70-14-48
2. Nairo Quintana (Col) Movistar Team, at 31 secs
3. Vincenzo Nibali (Ita) Bahrain-Merida, at 1-12
4. Thibaut Pinot (Fra) FDJ, at 2-38
5. Ilnur Zakarin (Rus) Katusha-Alpecin, at 2-40
6. Domenico Pozzovivo (Ita) AG2R La Mondiale, at 3-05
7. Bauke Mollema (Ned) Trek-Segafredo, at 3-49
8. Bob Jungels (Lux) Quick-Step Floors, at 4-35
9. Steven Kruijswijk (Ned) Team LottoNl-Jumbo, at 6-20
10. Adam Yates (GBr) Orica-Scott, at 7-00
Thank you for reading 20 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1