Ugo Monye's try had put the visitors in control at the break with Nick Evans continuing his impressive form with the boot to slot two penalties and a conversion.
But after Andy Gomarsall and Tani Fuga were yellow carded James Downey stole in to se
cure the Saints' 10th consecutive home win.
And after watching his promoted side dent Harlequins' title ambitions, Mallinder insists Northampton can claim a first away triumph this season when they face Bath at The Rec next weekend.
"We're on a good run, but we haven't been getting the results in the Premiership so we need to keep the momentum and get something at Bath next week," said Mallinder.
"We're still learning lessons in the Premiership all the time. We're playing some good rugby at home but we still need to be smarter on the road.
"It's a good start to this period of games. We were pleased with the scrum and how that went because it was vital that we slowed Harlequins down.
"Dylan Hartley is competitive and aggressive and he's learning to look after himself. He's still young but you can see he's a good player.
"It's very nice to win and it's even better to win against a side who are playing so well at the moment."
Harlequins appeared to be cruising after establishing a seven-point lead at the break as Monye broke from behind a scrum to score.
But after Jon Clarke crossed within 60 seconds of the interval to drag Northampton level, Harlequins allowed a lack of discipline to creep in.
Gomarsall saw yellow for blocking Bruce Reihana and Fuga was sent to the sin-bin for bringing down the scrum.
And after seeing scrum-half Gomarsall leave Quins a man short, director of rugby Dean Richards defended his decision to rest England man Danny Care.
"We had to rest Danny at some stage as he's part of the Elite Squad," said Richards.
"We felt today was the right day to do it, as it has been a bruising few weeks for us and we can't just run him into the ground.
"I think we looked a bit tired. On the day we were a bit jaded. It's been a busy five weeks with some very difficult games and we didn't perform to the best of our ability.
"I don't think we were in control first half. Both sides didn't play well and it was a poor game of rugby.
"They came out more fired up in the second half and a couple of things went right for them.
"They played well and we have to take this onboard and learn from it."