Rob Harley made an immediate impact for Scotland as he came off the bench to score the winning try in the 17-16 victory against Samoa.
Scotland, winners over Australia and Fiji in their June internationals, had been trailing 16-10 with Samoa looking set to clinch the win.
However Harley, making his debut, crashed through a massive gap in the Samoa defence following an incessant spell of pressure to score in the final seconds - with Greig Laidlaw slotting over a simple conversion.
Joe Ansbro, a late change to the line-up after Nick De Luca failed a fitness test, had scored in the first half to give Scotland a 7-6 lead.
However Tusi Pisi's 16 point haul - two penalties, a drop-goal, a conversion and a try - had given the South Sea Islanders hope.
Samoa were in complete charge of the opening exchanges, with full-back Faatoina Autagavaia twice coming close to a breakthrough before Pisi slotted an early drop goal.
However on their first serious visit to the Samoan half, Scotland made it pay. Centre Matt Scott made the score with a superb solo break through traffic in the middle of the field, with scrum-half Chris Cusiter in support. And following two rucks lock Richie Gray had just enough power to get to the line where Ansbro was on hand to touch down.
Laidlaw slotted the touchline conversion, which proved crucial because Samoa were making a much better job of holding onto the ball and were soon back in kicking range, Pisi cutting the Scots' advantage to one point.
Both sides had tries chalked off - through Tim Visser and Maurie Fa'asavalu - to leave the Scots holding a narrow advantage at the break.
Samoa, however, got first blood in the second half with a second Pisi penalty, but they then wasted a good try-scoring opportunity.
Scotland did manage to regain the lead with winger Sean Lamont earning the penalty but they were living dangerously and were lucky when Pisi missed from wide out on the left.
It could not last and the biggest cheer of the afternoon came when Paul Williams provided the cutting edge round the blind side of a ruck and found Pisi in support to score.
Scotland got lucky again when Visser spilled the ball and wing Paul Perez picked up to race for the line, only for the touch judge to rule that Visser had edged into touch before dropping the ball.
Scotland used the position to mount their best attack of the half, turning down a kickable penalty and going for a scrum but failing to shift the mighty Samoan pack. A second and a third scrum followed before Scotland eventually let it out into the backs, only to run into a brick-wall home defence.
When Sean Lamont knocked on a bouncing pass, it appeared their chance had gone, but Harley had the final word.