The Stormers reached the Heineken Champions Cup quarter-finals for the first time despite three late Harlequins tries in Cape Town.
In a blistering start, the hosts' Deon Fourie and Alex Dombrandt of Quins exchanged tries before Steven Kitshoff re-established Stormers' lead.
Fourie doubled his tally before Damian Willemse's finish and a Willie Engelbrecht score added the gloss.
Dombrandt, Andre Esterhuizen and Joe Marchant scored late consolations.
Stormers will visit either Exeter or Montpellier in the last eight.
Quins toil in heat before late fightback
If Harlequins were already feeling the heat in Cape Town, it intensified with less than a minute on the clock when Fourie finished off a flowing team move after clever hands from Hacjivah Dayimani.
The visitors recovered quickly as Dombrandt freed himself from a driving maul to crash over, but Stormers regained the lead with a set-piece move from their own line-out and skipper Kitshoff dotted down for the game's third try in nine minutes.
Quins playmaker Marcus Smith barely touched the ball in the opening 20 minutes as Stormers exerted their dominance at the breakdown to limit his access to quick ball.
And, as the pitch began to cut up beneath the players' feet, the hosts kept the ball tight and rolled through the phases to test the Quins defence.
Fourie ran clear for his second to stretch the hosts' advantage after the interval, before Willemse scored the try of the game.
Seabelo Senatla caught Manie Libbok's cross-field kick and threw it back inside in one movement to the full-back, who maintained his balance despite Marchant's desperate shove to ground the ball in the corner with his body in mid-air.
The game was up when Engelbrecht scored from another rolling maul, but the inevitability of defeat appeared to release the shackles for the Premiership side, who began to play with a freedom their performance lacked for the first 70 minutes.
First Dombrandt got over out wide after a stunning Smith pass, before Esterhuizen ran through unopposed, then Marchant gathered the loose ball for an easy run-in score with the clock in the red.
Quins' wait for victory in a Champions Cup knockout game goes on, but Stormers join the Sharks as the second South African side in the last eight.
Teams
Stormers: Willemse; Hartzenberg, Nel, Du Plessis, Senatla; Libbok, Jantjies; Kitshoff (c), Dweba, Malherbe, Van Rhyn, Orie, Fourie, Dixon, Dayimani.
Replacements: Kotze, Harris, Fouche, Porter, Engelbrecht, Theunissen, De Wet, Blommetjies
Harlequins: David; Marchant, Northmore, Esterhuizen, Murley; Smith, Care (c); Marler, Walker, Louw, Lamb, Herbst, Kenningham, Evans, Dombrandt.
Replacements: Riley, Baxter, Collier, Hammond, Lawday, Gjaltema, Allan, Beard