Gloucester inflicted a fifth straight Premiership defeat on Harlequins with a 28-26 victory at Kingsholm.
The hosts' Seb Blake and Quins' back-rower Tom Lawday traded tries in the opening 10 minutes before Ollie Thorley gave Gloucester the lead at half-time.
Cadan Murley brought Quins back within two before Sam Riley put them in front.
But tries from Santiago Carreras and Wales wing Louis Rees-Zammit secured a bonus-point win before Matas Jurevicius salvaged two bonus points for Quins.
Their last win in the Premiership came back on 2 December and the Londoners last lost five consecutive league matches in 2019.
The late score for Jurevicius, their fourth try, at least ensured they stay within a tight top five in the table, while the Cherry and Whites move up to third for now.
The evening started less than ideally for the visitors when James Chisholm was sent to the sin-bin only four minutes in and Gloucester kicked to touch for their first line-out. With a man advantage in the maul, Blake dived over for his first try for the club.
Lawday drew Quins level from their own driving maul shortly after, but Gloucester re-took the lead thanks to an excellent cross-field kick from Carreras and a similarly skilful catch from Thorley in the corner.
The hosts had the upper hand at the breakdown during the first half, with Quins conceding seven penalties to Gloucester's three in the opening half-hour.
Yet it was the Londoners who got the first points on the board after the break.
Danny Care - making his record 352nd appearance - reacted quickest from a scrum as the ball went loose to win possession in Gloucester's 22. As Quins moved through 11 phases, the ball was eventually shipped out wide for Murley to score.
Riley added Quins' third try from close range but the night belonged to Gloucester, who had not beaten Quins since March 2019.
Jack Clement made the first line break before passing inside to Carreras, who darted through a gap and under the sticks.
The Argentine fly-half then provided his second assist, unleashing Rees-Zammit, who was making his return from an ankle injury off the bench after eight weeks out.
The Wales wing almost scored a spectacular try seconds after coming on, sprinting down the blindside, palming off Murley and evading a tackle from Nick David before diving for the corner - only to see it scrubbed off for a foot just in touch.
But Rees-Zammitt eventually got his name on the scoresheet five minutes from time, sprinting onto Carreras' pass to touch down, a week before Wales' Six Nations showdown with England.
Despite victory being out of reach, Quins doggedly pushed for a fourth try and Jurevicius crossed with the clock in the red to ensure they did not leave entirely empty-handed.
Gloucester head coach George Skivington told BBC Radio Gloucestershire:
"I was a little bit frustrated with 20 minutes to go because I thought we created a lot and Quins were very good at the defensive breakdown and got on top of us there. We were getting a bit frustrated because we were making some good breaks and not quite capitalising on them.
"That is an area we're working on and I was really pleased to see some transfer from what we've done the last couple of weeks into the game. It's not perfect by any means but I thought we created a lot.
"I back our lads to fight for 80 minutes all the time, that's a big thing we set out to do and we've done for the last few years.
"It is an 80-minute game and we scored at the beginning and we scored at the end and in the middle - certainly that front end of the second half we didn't get much action - you've just got to stay in the fight."
Harlequins head coach Tabai Matson said:
"They deserved the win, but we walk away with two points which I think are going to be critical at the end of the day. Any points are going to be really valuable.
"We scored four tries here, and they are one of the best defensive sides in the league. With 10 minutes to go, we had it in our sights, so there are lots of positives.
"It is great when the league table changes every weekend. It will definitely come down to the last weekend, and those two points could be very valuable.
"We are running out of runway. We have got six games to go, and now they become must-wins."
Gloucester: Evans, May, Harris, Atkinson, Thorley, Carreras, Meehan; Rapava-Ruskin, Blake, Gotovtsev, Clarke, Alemanno, Ackermann, Ludlow (c), Tuisue.
Replacements: Walker, Elrington, Ford-Robinson, Jordan, Clement, Chapman, Seabrook, Rees-Zammit,
Harlequins: David, Murley, Beard, Esterhuizen, Bassett, Allan, Care; Marler (c), Musk, Louw, Lamb, Herbst, Chisholm, Wallace, Lawday.
Replacements: Riley, Baxter, Kerrod, Hammond, Jurevicius, Steele, Edwards, Northmore.
Sin bin: James Chisholm (4 mins)
Referee: Luke Pearce