Harlequins had to battle for victory at Gloucester as tries from Luke Northmore and Danny Care got them over the line.
The Premiership champions had been 10-0 behind after a Ruan Ackermann try had given the Cherry and Whites the lead. Ackermann powered over the line after a neat line-out move.
Gloucester should have gone further ahead when prop Val Rapava Ruskin knocked on just short of the try-line as he tried to finish what would have been a fantastic end-to-end team score.
However, in an entertaining first half – Quins centre Luke Northmore crossed and Marcus Smith converted and kicked a penalty to level the scores at the interval.
After the break, neither side could forge ahead as Harlequins dominated territory. Smith saw a penalty strike the left upright shortly after the hour.
Care went over after concerted pressure from Quins in the second half and they held on despite Santiago Socino’s late score for the hosts.
Smith then put them more than a converted score ahead with his second successful penalty and that would ultimately prove to be the difference as replacement hooker Socino’s converted score from a rolling maul was not enough to earn a draw for Gloucester.
Quins stay third after backing up their victory against Northampton, while Gloucester remain fourth despite coming away with a losing bonus point.
Harlequins’ next fixture will see them host Exeter in a repeat of last season’s Premiership final on Saturday while Gloucester travel to Saracens on the same afternoon.