Saints looked destined for defeat after a 15-point haul from former Wales fly-half Arwel Thomas gave Quins a commanding 20-12 lead which they looked unlikely to surrender with just a couple of minutes left.
But Budge Pountney's men poured forward in a thrilling finale, closing the gap with a Drahm penalty before winger Mark Tucker crossed in the left corner with 85 minutes on the clock. Man of the match Drahm did the rest.
Victory has ended a miserable few days for Northampton. Earlier this week prop Robbie Kempson, who has now left Franklin's Gardens, launched an astonishing attack on his former employers.
He revealed the extent of the rift between the South African and English contingents at the club, criticised the way coach Alan Solomons was forced out and even alleged South Africa winger Wylie Human had been subjected to racial abuse from his own team-mates.
Meanwhile, chairman Keith Barwell used his programme notes to criticise claims made in internal email to a Rugby Football Union disciplinary officer that there is potential for a referee to be assaulted at Franklin's Gardens.
But there was little evidence of any hostility on Saturday – referee David Rose seemed happy enough – and the home crowd cheered as if they had guaranteed their Zurich Premiership survival when the final whistle went.
It was a grandstand finish which will have given Saints a timely lift ahead of Friday's Heineken Cup quarter-final against Toulouse, but there was little indication of the drama to come in a dull opening.
Harlequins' line out functioned beautifully early on with one catch-and-drive carrying the visitors to within 15 metres of the whitewash. Saints' discipline slipped under the pressure and Thomas booted the first points of the afternoon.
A Drahm penalty levelled matters in the ninth minute before a sublime chip through from the Australian fly-half created a fantastic opportunity which was squandered by Marc Stcherbina who overcooked his fly-hack forward.
Saints continued their assault on Quins' line but were met by some impressive defending and eventually had to settle for a Drahm penalty which was soon cancelled out by another three points from Thomas.
The former Wales outside-half turned sinner in the 24th minute, however, when referee Rose gave him 10 minutes in the sin bin for a deliberate knock-on as Northampton threatened to score.
Drahm rifled over the accompanying penalty but Saints were then forced back by a series of attacks by Quins with winger Simon Keogh setting up a strong field position with a powerful run.
George Harder knocked on and Quins then conceded a penalty, but with Harder on the rampage once again they were soon back in enemy territory, claiming the try their dominance justified.
Saints attempted to run their way out of danger but their ambition proved fatal as the ball was turned over and swiftly fed to Harder who shrugged off two despairing tackles to touch down.
Thomas' yellow card expired in time for him to complete the conversion, but he had hardly been missed with Quins enjoying their best spell of the first half while he was away.
He was the centre of attention seven minutes into the second half, however, for scoring Quins' second try after intercepting a loose pass from Stcherbina and winning the 60-metre foot race for the line.
Thomas converted his own try before Drahm slotted a penalty, prompting a purple patch from the home side who went close through winger John Rudd in the right corner.
They were guilty of wasting a magnificent chance after being too slow to react to a two-man overlap on the right. When they did finally spot the opening their handling was so poor Quins were able to cover across.
Sloppy handling cost them another certain try – they had created enough chances to win the match several times over – but eventually they broke through with Tucker crossing and Drahm's ice-cool conversion.
For Northampton Saints:Try: TuckerCon: DrahmPens: Drahm 5
For NEC Harlequins:Tries: Harder, ThomasCons: Thomas 2Pens: Thomas 2