Robert Harley came off the bench to score the winning try for Scotland as they scraped home 17-16 in a one-off Test against Samoa on Saturday.
Harley's try in his debut outing came minutes from full-time and ensured Scotland completed a clean sweep on their Southern Hemisphere tour for the first time.
In the clash of the Six Nations wooden spooners against the Pacific Nations Cup champions, Samoa recovered from a 6-7 half-time deficit to lead 16-10 midway through the second half leading to a tense closing quarter.
Scotland applied relentless pressure on the Samoa line but were held out by a spirited defence until Harley crashed over from a tap penalty five metres out from the line.
The 22-year-old Glasgow Warriors forward has frequently been Scotland's extra player taken as a precaution on Six-Nations duty and was a late deletion from last year's World Cup squad.
He was not required to suit up for Scotland's opening tour matches - a 9-6 victory over Australia in atrocious wet-weather conditions followed last week by a 37-25 win over Fiji in searing Pacific island heat.
But when finally given his chance when named in the replacements to play Samoa, he came off the bench to be Scotland's hero when he crashed over by the posts for Greig Laidlaw to land a simple conversion for the one-point victory.
Samoa, with several European-based players in their line up, opened the scoring with penalty to flyhalf Tusi Pisi who produced all their 16 points in the match.
Joe Ansbro replied with try converted by Laidlaw and Pisi landed a second penalty for Scotland to lead 7-6 at the break.
Pisi and Laidlaw traded penalties early in the second half before Samoa inside centre Paul Williams found a gap between Gray and left wing Tim Visser to put Pisi in for Samoa's sole try.
The islanders clung to their 16-10 lead for nearly 20 bruising minutes and appeared to be heading for their first win over Scotland in eight Tests before Harley's try turned the result around.
Pens: Pisi 3
Tries: Ansbro, Harley
Cons: Laidlaw 2
Samoa: 15 Fa'atoina Autagavai, 14 Paul Perez, 13 Fautua Otto, 12 Paul Williams, 11 David Lemi (captain), 10 Tusi Pisi , 9 Kahn Fotuali'i, 8 Kane Thompson, 7 Maurie Fa'asavalu, 6 Ben Masoe, 5 Daniel Crichton, 4 Fa'atiga Lemalu, 3 Census Johnston, 2 Ti'i Paulo, 1 Sakaria Taulafo.
Replacements: 16 Wayne Ole Avei, 17 Logovi'i Mulipola, 18 Joe Tekori, 19 Afa Aioni, 20 Jeremy Sua, 21 Ki Anufe , 22 Lolo Lui.
Scotland: 15 Stuart Hogg, 14 Sean Lamont, 13 Nick De Luca, 12 Matt Scott, 11 Richie Gray, 10 Greig Laidlaw, 9 Chris Cusiter, 8 Richie Vernon, 7 Ross Rennie, 6 Alasdair Strokosch, 5 Alastair Kellock, 4 Richie Gray, 3 Euan Murray, 2 Ross Ford (captain), 1 Ryan Grant.
Replacements: 16 Scott Lawson, 17 Geoff Cross, 18 Tom Ryder, 19 Robert Harley, 20 Mike Blair, 21 Duncan Weir, 22 Max Evans.
Referee: Jaco Peyper (South Africa)
Assistant referees: Ian Smith (Australia), Andrew Lees (Australia)