Six Nations - Scotland avoid wooden spoon with win
Early signs suggested Italy, fresh from their win over France in Rome last weekend, would consign Scotland to their first competition whitewash since 2007 as they enjoyed the better of the first half.
The second half was an entirely different story, however, as Scotland rebounded with 15 unanswered points, tries through Nick Da Luca and Nikki Walker doing the damage.
Scotland made a breathless start to the match and raced through 12 phases of possession, working their way towards the line before full-back Chris Paterson kicked the first three points of the game.
Italy saw their first three line-outs stolen by Scotland and heads started to drop slightly when Mirco Bergamasco pulled his first kick at the posts wide.
But, as throughout the tournament, a moment of brilliance from Andrea Masi proved to be the early turning point for Italy, as the full-back beat Joe Ansbro, Walker and Paterson on the left wing to race away for the opening try of the day.
Bergamasco bounced his conversion kick off the left upright and it briefly looked as though that could prove costly for the Italians as the hosts pressed deep into opposition half.
But Scotland had not scored a try at Murrayfield since 2009 and it showed as the absence of pacey winger Max Evans - out with an ankle injury - seemed to sap inspiration from the hosts.
With plenty of possession inside the Italian 22, Scotland were just one final pass away from crossing over the line.
Simon Danielli came closest but last-gasp defence from the Italians held the winger up just millimetres short of the line and Scotland had to settle for just three points as Paterson kicked his second penalty of the day when Italy were caught offside at the ruck.
Scotland lost Ansbro to a knee injury although that was quickly evened up when Italy lost the talismanic Masi, also to a knee injury just over 10 minutes later, at the same time as Italy regained the lead, thanks to a Bergasmasco penalty kick, which they held on to into the interval.
The hosts rebounded in impressive fashion, however, and should have taken the lead inside five minutes when Sean Lamont raced off after a loose ball only to take his foot off the gas at the last minute and lose the footrace to Italy hooker Leonardo Ghiraldini.
But Da Luca, on for the injured Ansbro, made amends just five minutes later, receiving the ball from a very quiet Nathan Hines before forcing his way over the line to score his first international try.
Paterson missed the conversion kick, to add to the penalty attempt he missed just before the interval, but the momentum had changed and a second try for the hosts was not far behind.
Paterson picked out Walker, after receiving the ball from Ruaridh Jackson, and the replacement full-back used his impressive strength to force his way past Alessandro Zanni and Luke McLean before out-pacing Fabio Semenzato to touch down in the corner.
This time Paterson did land the conversion and also added a penalty in the 68th minute to put the result out of contention.
Italy should have had a late consolation try as McLean raced away down the left wing, running the ball from inside his own half, only for last-man Paterson to bring him down five metres short of the line.
Italy will feel hard done by to have ended bottom of the standings but a win over France, as well as close matches with Ireland and Wales will have done wonders to the Azzurri's confidence, while Scotland will be relieved not to be heading into September's World Cup on the back of a five-match losing streak.