A late conversion by the French stand-off Thierry Lacroix ensured Gloucester's recent losing record against Harlequins continued at Kingsholm yesterday.
He landed a superb kick from the touchline after Gareth Llewellyn had rounded off a period of late Quins pressure with the visitors' second try.
Gloucester rallied again for a final onslaught, but could not penetrate the Quins defence and lost their sixth match in a row against the London club.
Harlequins started strongly with a fifth-minute penalty chance for Lacroix, who hit the post, but four minutes later full-back Jamie Williams provided the finishing touch to a fine move from a line-out. Lacroix made no mistake with the conversion.
In the 14th minute referee Nick Cousins showed yellow cards to Neil McCarthy and Jason Leonard after a fracas at a scrum.
Fourteen minutes before half-time Gloucester equalised after a solo break by Mark Mapletoft. He bamboozled the Quins pack before sidestepping Lacroix to set up Gloucester's Western Samoan centre, Terry Fanolua, for the try, which Mapletoft converted.
A Lacroix penalty restored Quins' lead, but Mapletoft's penalty made it 10-10 at the interval.
He then gave Gloucester the lead for the first time five minutes into the second half with another penalty and added his third on the hour to give home fans hope of victory.
But nine minutes from the end, as Quins raised their game, they won a succession of penalties inside Gloucester's 22 and Llewellyn galloped over for the try which Lacroix converted.
Gloucester: Tries Fanolua; Conversion Mapletoft; Penalties Mapletoft 3. Harlequins: Tries Gareth Llewellyn, Williams; Conversions Lacroix 2; Penalties Lacroix.
Tonga suffered another setback in the build-up to their international with Wales in Swansea on 16 November when they lost 26- 14 to Edinburgh yesterday. It was the second defeat of their British tour.
Two penalties by Duncan Hodge and a drop goal from Gordon Ross gave the Scots a 9-0 lead at half-time, which they streched to 21-0 with tries from Darren Burns and Dave Clark.
Tonga finally came into the game when Peter Tanginoa ran in two tries before the Edinburgh full-back, Campbell Aitken, collected a wayward kick and put in Steve Reed to complete the scoring.