Alasdair Strokosch scored a try after the siren and Greig Laidlaw converted to give Scotland a 30-29 win over Italy on Saturday in the play-off for third in the four-nation rugby tournament in South Africa.
The dramatic climax atoned for a lot of scrappy play at sun-drenched Loftus Versfeld between a couple of weary Six Nations championship sides at the end of an 11-month season.
Scotland camped deep in Italian territory as the clock ticked away and after a 17-phase movement failed to reap any reward, flanker Strokosch broke from a scrum and punished slack marking to go over beside the posts.
Captain and scrum-half Laidlaw converted for a 15-point contribution that earned him the man-of-the-match award.
Italy's sole try came after 52 seconds through debutant right wing Leonardo Sarto while Scotland managed three with Matt Scott and Sean Lamont preceding Strokosch's effort.
Italy - Tries: Leandro Cearo (1), penalty try, Conversions: Alberto Di Bernado (2) Penalties: Alberto Di Bernado (5)
Scotland: Tries: Matthew Scott, Sean Lamont, Alasdair Strokosch. Conversions: Greig Laidlaw (3). Penalties: Greig Laidlaw (3)