Tonga secured their first ever win over Scotland as Andy Robinson's men, playing at Pittodrie, suffered their third autumn Test defeat in a row.
Two Greig Laidlaw penalties to one by Fangatapu Apikotoa gave the Scots a narrow and deserved half-time lead.
But after the break Tukulua Lokotui squeezed over the line and Apikotoa dinked over the conversion.
Three Laidlaw penalties were not enough for the Scots as Fetu'u Vainikolo added a second try for the Tongans.
The result, following autumn Murrayfield losses to the All Blacks and South Africa - the two highest-ranked teams in the world - will pile the pressure on Robinson.
Scotland's trio of wins in their summer tour of Australia, Fiji and Samoa had helped to ease the strain on the Scotland head coach following a dismal Six Nations.
But this result in Aberdeen will be a painful blow.
It was an attritional affair on a narrow pitch which limited space and, once again, Scotland's passing lacked the accuracy required as the ball hit the floor with alarming regularity.
Scotland lacked ideas to overcome their physical opponents, who had three players sin-binned but were deserved winners as the hosts tasted defeat in Scotland's north-east for the first time.
The Scots made six changes to the team that had lost to the Springboks, with scrum-half Henry Pyrgos and loosehead prop Kyle Traynor making their first starts.
Tonga lost to Italy and beat the United States this month and featured a host of European-based players eager to claim another northern hemisphere scalp following their World Cup win over France in the third Test between the sides.
Apikotoa slotted an easy penalty to give Tonga the lead before Laidlaw calmed Scottish nerves with two successful kicks for a 6-3 score at the break.
Scotland struggled with ball in hand, a Sean Lamont carry deep into the 22 one of the few occasions the hosts breached enemy lines.
A penalty followed which Laidlaw kicked to extend the lead to six points, but Tonga kept up the pressure.
Apikotoa missed the chance to reduce the arrears, but Tonga's persistence paid off when they spread the ball wide and Lokotui burrowed over. Apikotoa converted to put Tonga 10-9 ahead.
Laidlaw kicked two more penalties to give the hosts a five-point lead entering the final quarter, but the advantage crumbled all too easily.
The ball was spread wide to Vainikolo, who simply stepped up the pace and ghosted down the left, evading substitute Nick De Luca, to score.
The conversion was missed by Apikotoa and Bath fly-half Tom Heathcote came on for his debut.
Nili Latu became the second Tongan sin-binned 11 minutes from time for leaping on top of a maul, but Heathcote's resulting penalty was short.
The task became tougher for Scotland when Apikotoa kicked his third penalty to leave the hosts requiring a converted try to win with six minutes left.
Sione Timani was sin-binned, temporarily reducing Tonga to 13 men before Latu returned, with an attacking scrum for Scotland as the game ticked into added time.
Scotland nudged forward, but captain Kelly Brown lost control at the base of the set-piece and Tonga scrambled clear.
The last act of the game was Heathcote dropping a Rory Lawson pass as Scottish players stood crestfallen - and defeated - across the pitch.
Scotland: Hogg, Lamont, Evans, Scott, Visser, Laidlaw, Pyrgos, Traynor, S. Lawson, Murray, Gray, Kellock, Strokosch, K. Brown, Denton.
Replacements: De Luca for Evans (64), Heathcote for Laidlaw (71), R. Lawson for Pyrgos (55), Hall for S. Lawson (52), Cross for Murray (52), Barclay for Denton (55).
Not Used: Reid, Gilchrist.
Tonga: Lilo, Vainikolo, Hufanga, Piukala, Helu, Apikotoa, Moa, Taumalolo, Taione, Aulika, Tuineau, Lokotui, T-Pole, Latu, Ma'afu.
Replacements: Fatafehi for Piukala (72), Iongi for Helu (78), Ma'asi for Taione (76), Mailau for Aulika (47), Mafi for Tuineau (78), Timani for T-Pole (52).
Not Used: Sakalia, Paea.
Sin Bin: Lokotui (33), Latu (74), Timani (79).
Ref: Mathieu Raynal (France).