Wigan scratched out their first win of the season, thanks to an interception try from Amos Roberts five minutes from time.
The winger capitalised on a mistake from one of Quins' best players on the night, Chad Randall, and, in the time remaining, Sean O'Loughlin's kick set up Shaun Ainscough for his second and the campaign was at last up and running for Brian Noble's men.
"We weren't helping ourselves in the first half, but we finished the game strong," said Noble, who acknowledged the role of his two 19-year-olds, Ainscough and Sam Tomkins.
A nervous Wigan were lucky to take the lead with their first real attack and it was Ainscough, who did the damage.
If that should have settled them down, two tries in three minutes from Quins threw them back into confusion. The first was credited to Randall, despite a suspicion of a knock-on in the build-up.
There was no debate about the second - apart from over where Wigan's defence had gone when Matt Gafa was put through a gaping hole by a long pass from their former player, Danny Orr, who also added the goal for a deserved four point lead at half-time.
It was Wigan's two rookies who ignited them after the interval, Tomkins making an electrifying break and Ainscough throwing an audacious, blind pass for George Carmont to equalise.
Pat Richards missed an easy kick, but within two minutes supplied the pass from which Phil Bailey muscled his way over, albeit with a suspicious double-movement, to put Wigan back in the lead.
Quins thought they had squared it up again when Will Sharp dived in at the corner, but the video ref ruled that he had lost control.
A 40/20 kick from Randall put Harlequins back on the attack and this time Louis McCarthy-Scarsbrook was too strong for four tacklers as he plunged over to level the scores.
They hit the front ten minutes from time, running the ball on the last tackle of a set and Orr sending over Chris Melling.
Time was starting to run out when Randall's ill-advised pass gave Roberts the chance to record his first Wigan try - and possibly the most important he will ever score for them.
Harlequins: Wells; Melling, Gafa, Howell, Sharp; Dorn, Orr; Temata, Randall, Ward, Robinson, Clubb, Purdham. Substitutes used: McCarthy-Scarsbrook, Golden, Heckenberg, Gale.
Wigan: Richards; Roberts, Bailey, Carmont, Ainscough; Smith, Leuluai; Fielden, Riddell, Coley, Hock, J Tomkins, O'Loughlin. Substitutes used: Paleaaesina, O'Carroll, Hansen, S Tomkins.
Referee: T Alibert (France).
- More about: