A last ditch try from James Chisholm saw Harlequins stun Wasps 33-28 at the Stoop, landing a blow to their visitors' hopes of qualification.
Wasps had led 21-0 and 28-12 at different points of the game but somehow Quins clawed their way back into matters and eventually prevailed.
Their scorers were Ross Chisholm, James Lang, Danny Care, Elia Elia and flank Chisholm, with fly-halves Lang and Marcus Smith adding kicks.
Wasps, who missed the chance to move to within two points of their pool summit, crossed through Kyle Eastmond, Nizaam Carr, Ashley Johnson and Brendan Macken. However Dai Young's men will be wondering how they lost this game as they were well on top for large periods.
It was scoreless for the opening 17 minutes and it took a harsh yellow card for Harlequins prop Lewis Boyce to spark the match into life.
Following that sin-binning, Wasps made Quins pay as slick hands led to Willie le Roux finding Thomas Young who set up Eastmond for a try.
Wasps gained confidence from that score and doubled up three minutes later as Carr raced over from distance, his dummy a thing of beauty.
Just after the half-hour mark it was a 21-0 advantage as Johnson grounded at the back of a strong line-up drive, with Quins on the ropes.
But they crossed twice before the break to give them hope of a comeback, with first Chisholm scrambling over after an end-to-end passage that saw Lang heavily involved, before the aforementioned 10 stepped beautifully to go in under the posts in the final play of the half.
The first score of the second-half was always going to be crucial and it went the way of Wasps on 56 minutes, with Danny Cipriani's lovely flat pass finding centre Macken for a close-range score. That was Wasps' bonus-point try but there was still plenty of time for Quins to fight back.
The comeback was on with 15 minutes remaining when Care burrowed over from the base of a ruck to hand Quins a real chance at 28-19 down.
Harlequins were now motoring and it became a two-point match on 70 minutes as replacement hooker Elia stepped inside Le Roux superbly on the left wing, with another substitute, Smith, landing the touchline extras. The grandstand finish was now very much on the cards.
Quins' hopes of victory were further boosted by James Haskell, who was red carded with four minutes to play for a high tackle on Jamie Roberts. And the comeback was complete in the final play as flanker Chisholm dived over from close range, with Smith adding the gloss off the tee.
Tries: Chisholm, Lang, Care, Elia, J Chisholm
Cons: Lang, Smith 3
Yellow Card: Boyce
Tries: Eastmond, Carr, Johnson, Macken
Cons: Cipriani 4
Red Card: Haskell
Harlequins: 15 Mike Brown, 14 Charlie Walker, 13 Alofa Alofa, 12 Jamie Roberts, 11 Tim Visser, 10 James Lang, 9 Danny Care, 8 Renaldo Bothma, 7 Archie White, 6 James Chisholm, 5 Ben Glynn, 4 George Merrick, 3 Kyle Sinckler, 2 Dave Ward (c), 1 Lewis Boyce
Replacements: 16 Elia Elia, 17 Mark Lambert, 18 Phil Swainston, 19 Charlie Matthews, 20 Mat Luamanu, 21 Dave Lewis, 22 Marcus Smith, 23 Ross Chisholm
Wasps: 15 Willie le Roux, 14 Christian Wade, 13 Brendan Macken, 12 Kyle Eastmond, 11 Marcus Watson, 10 Danny Cipriani, 9 Dan Robson, 8 Nizaam Carr, 7 Thomas Young, 6 James Haskell, 5 James Gaskell, 4 Joe Launchbury (c), 3 Jake Cooper-Woolley, 2 Ashley Johnson, 1 Simon McIntyre
Replacements: 16 Tom Cruse, 17 Ben Harris, 18 Marty Moore, 19 Kearnan Myall, 20 Guy Thompson, 21 Joe Simpson, 22 Rob Miller, 23 Guy Armitage
Referee: Romain Poite (France)
Assistant referees: Thomas Charabas (France), Vincent Blasco (France)
Television match official: Eric Briquet Campin (France)