The Exiles were trying to lift themselves off the bottom of the Gallagher Premiership and saw a 14-0 half-time lead cancelled out before regaining the advantage in the closing stages through Paddy Jackson's penalty.
This was after Irish's Ben Donnell and Quins' Nick David had both been sent off for dangerous tackles, but the hosts, as is so often the case, would not be denied as they lifted themselves up to fourth.
Harlequins had Josh Bassett sin-binned eight minutes into his debut for a deliberate knock-on, and London Irish immediately made the most of their one-man advantage.
The resulting penalty was kicked to the corner and their driving maul proved unstoppable as No.8 So'otala Fa'aso'o grounded the ball over the line, with Jackson converting.
It was 14-a-side when the Exiles' Rob Simmons saw yellow for a high shot on Tommy Allan, but his team-mates were soon celebrating a second try when Donnell forced his way over from close range.
Jackson added the extras again to open up a 14-0 lead that lasted until the break, but the hosts were back in the game four minutes after the restart when Danny Care's pass gave Allan an easy finish near the posts.
In a further boost to Quins' hopes, Donnell was shown a red card for a dangerous tackle on Joe Marler in the build-up, and suddenly all momentum appeared to be with the home side.
Not for long, though, as a depleted Irish hit back almost immediately when Benhard Janse van Rensburg moved the ball left to put James Stokes into space and he timed his pass to allow Ollie Hassell-Collins to finish in the corner.
Jackson's conversion meant a 14-point gap between the teams again, but this was soon halved when Alex Dombrandt, making his comeback from injury, barged over from a few metres out.
The match was then all-square when a strong five-metre scrum from Quins led to Care feeding Allan, whose nifty footwork sent him through a gap to score his second, with him then converting.
Another twist quickly followed as the numbers out on the field were levelled up by a red card to David for a high hit on the Exiles' Luca Morisi.
Quins collapsing a scrum then gave Jackson the chance to kick the visitors back in front with nine minutes left, but this still did not prove decisive.
That was because Harlequins snatched victory with the clock deep in the red as a driving maul found top gear when it mattered most to allow hooker Head to get the ball down.
Additional reporting by PA.