Mark Evans' side were edged out by the narrowest of margins in a nerve-shredding clash and would have escaped with victory had fly-half Jeremy Staunton landed a kickable 80th-minute penalty.
It was a bitter pill for Quins fans to swallow following a courageous performance from their side against an error-prone Sale outfit, but they could have few complaints overall, given the club's performance this season.
The Sharks bounced back from 22-10 down early in the second half, with Mark Cueto touching down and the boot of Charlie Hodgson doing the rest to steal the Stockport-based club a spot in the Premiership play-offs.
Harlequins stormed into the game, and scored almost immediately.
Excellent work at the line-out saw quick ball released wide where Staunton was able to power through a tackle from Robert Todd and crash over with just three minutes on the clock.
Tony Diprose was prominent in the build up to the try and a bullocking run from the number eight helped Quins into a promising position shortly after, but a knock on allowed Sale to escape.
They produced another attacking line-out in the 13th minute and drove over from five metres out. Television Match Official Geoff Warren ruled that hooker James Hayter had grounded the ball, and Quins were 12-0 ahead.
Staunton missed the conversion this time but Quins were soon back on the offensive, although when this attack was halted a lengthy brawl broke out with Pearson opting to give the Sharks a penalty.
The home side had controlled the tempo of the match for the first 20 minutes and reaped the rewards, but the first time Sale were able to maintain possession for any length of time they ripped Quins to shreds.
Full-back Mark Cueto was heavily involved by jinking into a dangerous position before the ball was recycled and shipped left to second row Fernandez Lobbe, who soaked up a tackle and fed Jason Robinson on the loop.
The England star then fed Steve Hanley who slipped over for his ninth try of the season.
Charlie Hodgson slotted the conversion and then a penalty to slash Quins' lead to just two points while Staunton missed a three-pointer as Sale retained the initiative.
An injury-time rally saw Quins threaten once again as they pounded away at the visitors' line and won a scrum, only for their set-piece to buckle Sale's heavier pack made its presence felt.
But there was still time for them to add a third try in the 45th minute. George Harder made the initial break with the Samoan winger craftily offloading out of a Robinson tackle to Gavin Duffy, who raced home.
Hodgson landed his second penalty in the 46th minute as Sale edged the opening exchanges of the second half but a 30-metre rolling maul from a Diprose-taken line-out saw Quins rumble into an ominous position.
The Sharks could not halt their momentum through legal means, and Staunton rifled an easy kick between the uprights to provide Quins with some valuable breathing space.
Sale were performing well below par, dropping simple passes and conceding a hatful of penalties which put them under frequent pressure. Even their vaunted back three were frequently taking the wrong option.
Quins were being hammered in the scrums but bizarrely it was Sale who fell foul of Pearson's whistle with one set of scrums seeing the home side come under tremendous pressure – until they were let off with an ill-deserved free-kick.
Hodgson slashed the deficit with another penalty and the England fly-half then fired a 72nd-minute miss pass to Cueto who escaped tackles from Duffy and Will Greenwood before touching down under the posts.
Hodgson converted to set up a dramatic finale and the tension became unbearable in the 80th minute when substitute Stuart Turner conceded a penalty within Staunton's range – but the fly-half nudged it wide.
Quins tried desperately to get within range of a drop goal in the last throws of the match but Sale held on to consign their opponents to relegation.
For Harlequins:Tries: Staunton, Hayter, DuffyCons: Staunton 2Pen: Staunton
For Sale:Tries: Hanley, CuetoCons: Hodgson 2Pens: Hodgson 3
NEC Harlequins: 15 Gavin Duffy, 14 George Harder, 13 Will Greenwood, 12 Mel Deane, 11 Simon Keogh, 10 Jeremy Staunton, 9 Steve So'oialo, 8 Tony Diprose, 7 Andre Vos (Capt), 6 Nick Easter, 5 Simon Miall, 4 Roy Winters, 3 Jon Dawson, 2 James Hayter, 1 Mike Worsley.Replacements: 16 Ace Tiatia, 17 Ceri Jones, 18 Jim Evans, 19 Luke Sherriff, 20 Dafydd James, 21 Arwel Thomas, 22 Tom Williams.
Sale Sharks: 15 Jason Robinson, 14 Mark Cueto, 13 Jos Baxendell, 12 Robert Todd, 11 Steve Hanley, 10 Charlie Hodgson, 9 Bryan Redpath, 8 Peter Anglesea, 7 John Carter, 6 Jason White, 5 Chris Jones, 4 Fernandez Lobbe, 3 Barry Stewart, 2 Sebastien Bruno, 1 Andrew Sheridan. Replacements: 16 Andy Titterrell, 17 Stuart Turner, 18 Magnus Lund, 19 Ben Coutts, 20 Chris Rhys Jones, 21 Sililo Martens, 22 Mike Hercus.
Referee: Dave Pearson Touch judges: Peter Huckle, Bob Mullis Geoff Warren