The general classification riders were safe in their positions after that point, but it was then that Gaviria capped a fearless display with a storming finish despite pressure from Bora-Hansgrohe and Lotto-Soudal.
"I would like to keep the jersey for longer than past year but we have a big stage on Sunday at Blockhaus".
Shalunev and Paterski had earlier worked hard over the first part of the stage, which saw the gap on the peleton up to three-and-a-half minutes heading into the more flat final 50km.
Thomas' fellow Briton Adam Yates remains four seconds further back on the same time as defending champion and home favourite Vincenzo Nibali and 2014 victor Nairo Quintana of Colombia.
He finished in seventh place, one spot behind Dimension Data teammate Kristian Sbaragli of Italy, with Colombian rider Fernando Gaviria (Quick-Step Floors) winning the 159km stage from Pedara to Messina.
Post Comey's dismissal, Donald Trump seeks to mend ties with Russia
Yates was appointed for the transition period as a "neutral" administrator until President Donald Trump would appoint a successor. Commenting on this conversation on Fox news, President Donald Trump blamed the Obama administration for not vetting Flynn.
As the sprinters' teams battled to move their stage contenders to the front, Jungels remained alert to late attacks from his pink-jersey rivals and held off Thomas, but said the "crazy" circuit made it a nervous finale.
Gaviria's team-mate Bob Jungels of Luxembourg is still in the overall lead, maintaining his six-second advantage over Welsh Team Sky rider Geraint Thomas.
The 23-year-old only seemed to realise his error once the peloton had gone past him.
"We wanted to take some points because we were down a few".
"I think everyone's still finding their legs and sussing each other out but a good start. We were able to take the win here, now we'll leave the islands and head to the mainland and we'll see what happens". "I'm super happy that Fernando took the victory, but it cost me a lot of nerves here in Messina", Jungels said.