Mitchelton-Scott's Caleb Ewan finished in third place to hold on to the leader's ochre jersey, but suffered a moment of hesitation that would open the door for Viviani to take the stage win.
Ewan had plenty to thank his team for as they marshalled the front of the peloton throughout the final five kilometres, before huge efforts by final lead-out men Daryl Impey and Alexander Edmondson proved so powerful that Ewan found himself with a few metres advantage over the rest of the sprinters with less than 300m to go.
However with a slight headwind blowing down the finishing straight, the 23-year-old was reluctant to go too early, a decision that gave the opportunity for a rapidly accelerating Viviani to gain a jump from behind.
By the time Ewan realised the threat of Viviani it was too late, with the Italian carrying enough speed to come around his young rival, taking the stage win by a handsome margin, with Phil Bauhaus (Team Sunweb) edging Ewan down into third place.
How it happened
Temperatures of more than 40ºC saw stage three of the Tour Down Under trimmed from 146.5km to 120.5km, with riders facing just one lap of the finishing circuit around Victor Harbor rather than the three that were initially planned.
The day's breakaway consisted of two riders and had a familiar feel to it, with Nicholas Dlamini (Dimension-Data) and Scott Bowden (Uni SA-Australia) in the move for the third day in succession.
The two worked well together until the days first climb where Dlamini was in search of points to extend his lead in the mountains classification, attacking and dropping Bowden in the process.
However on a sweltering day in South Australia, Dlamini seemed unwilling to waste any more effort than necessary, and with the points swept up proceeded to wait for Bowden before dropping back to the peloton to leave the 22-year-old Australian to toil alone at the front of the race.
With just one rider up ahead, the peloton allowed the gap to Bowden to grow from one to more than three minutes with 40km to go.
That allowed Bowden to sweep up the two intermediate sprints before the gap began to close, and the catch was eventually made as the race approached the finishing circuit with 20km remaining.
The peloton might have hoped for a simple ride to the finish from there, but Tiago Machado (Katusha-Alpecin) had other ideas as he attacked with 17km to go, quickly establishing a gap of more than 20 seconds. However, that lead didn't last for long, and the Portuguese rider was soon back in the fold.
With eight kilometres remaining a left-hand turn into a crosswind section saw the real fight for position begin, with Mitchelton-Scott, Team Sky, Bahrain-Merida, Quick-Step Floors, and a number of other teams jostling for space at the front of the peloton ahead of the fast downhill run towards the finish.
The pace was exceptionally high as Mitchelton-Scott began to control proceedings going into the final kilometre with Caleb Ewan sat in the box seat just a few wheels back, but with the likes of Peter Sagan (Bora-Hansgrohe) and André Greipel (Lotto-Soudal) also in good positions to set up a grand finale.
The Mitchelton-Scott lead-out effort was exceptional, as a huge bursts of speed from Daryl Impey and then from Alexander Edmondson proved so powerful that Ewan found himself a little off the front of the peloton.
From that point the race looked like Ewan's to lose as he looked over his shoulders to see daylight behind, but the young Australian failed to see the rapidly accelerating Elia Viviani coming up from behind.
By the time Ewan had spotted Viviani it was too late, and with the Italian carrying superior speed he was able to cross the line first for the victory, with Ewan also missing out on second place to Team Sunweb's Phil Bauhaus.
However the third place on the stage was enough to see Ewan hold on to the leader's ochre jersey.
The Tour Down Under continues on Friday with a 128.2km stage from Norwood to Uraidla, which features an uphill finish and will start an hour earlier than initially scheduled as race organisers look to spare the riders from the worst of the afternoon heat.
Tour Down Under 2018, stage three: Glenelg to Victor Harbor, 148km
1. Elia Viviani (Ita) Quick-Step Floors, in 3-04-40
2. Phil Bauhaus (Ger) Team Sunweb
3. Caleb Ewan (Aus) Orica-Scott
4. Simone Consonni (Ita) UAE Team Emirates
5. Peter Sagan (Svk) Bora-Hansgrohe
6. Simon Clarke (Aus) EF Education First-Drapac
7. Alexander Edmondson (Aus) Mitchelton-Scott
8. Zak Dempster (Aus) Uni SA-Australia
9. Dries Devenyns (Bel) Quick-Step Floors
10. Jay McCarthy (Aus) Bora-Hansgrohe, all at same time
General classification after stage three
1. Caleb Ewan (Aus) Mitchelton-Scott, in 10-58-36
2. Elia Viviani (Ita) Quick-Step Floors, at 10 secs
3. Daryl Impey (Rsa) Mitchelton-Scott, at 14 secs
4. Jay McCarthy (Aus) Bora-Hansgrohe, at 15 secs
5. Peter Sagan (Slo) Bora-Hansgrohe, at 16 secs
6. Nathan Haas (Aus) Katusha-Alpecin, at 17 secs
7. Jhonatan Restrepo (Col) Katusha-Alpecin, at 19 secs
8. Simone Consonni (Ita) UAE-Team Emirates, at 20 secs
9. Robert Gesink (Ned) LottoNL-Jumbo
10. Anthony Roux (France) FDJ, at same time
Thank you for reading 5 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
Henry Robertshaw began his time at Cycling Weekly working with the tech team, writing reviews, buying guides and appearing in videos advising on how to dress for the seasons. He later moved over to the news team, where his work focused on the professional peloton as well as legislation and provision for cycling. He's since moved his career in a new direction, with a role at the Department for Environment, Food and Rural Affairs.