Harlequins (0) 5Try: Brown
Leinster (6) 6Pens: Contepomi 2
Brian O'Driscoll led his side to a riveting victory
Leinster set up an all-Irish Heineken Cup semi-final at Dublin's Croke Park after ending Harlequins' European dream in a pulsating contest at The Stoop.
Two Felipe Contepomi penalties gave the visitors a 6-0 interval lead.
But full-back Mike Brown's try with 14 minutes left finally breached the Leinster defence, only for replacement Chris Malone to miss the conversion.
Brown then missed a penalty chance before a limping Nick Evans sent a last-minute drop-goal attempt wide.
While Quins can count themselves unfortunate to lose after a ferocious effort, Leinster's magnificent defence was the foundation for a memorable victory.
They now contemplate a repeat of the 2006 semi-final against their Irish rivals, when Munster prevailed 30-6 at Lansdowne Road.
Harlequins, in their first Heineken Cup quarter-final since 1998, began as if they were intent on making up for lost time.
Fly-half Evans, who had done so much to steer the Londoners to this stage with his heroics against Stade Francais in the pool stage, made an early dart and offload to Gonzalo Tiesi.
His centre partner Jordan Turner-Hall was impressing in the midfield battle, but Evans failed to reward the early pressure by pulling a seventh-minute penalty wide.
Leinster wing Luke Fitzgerald tumbles after trying to claim a high ball
Leinster's kicking game was atrocious at times, Brian O'Driscoll, Isa Nacewa and Contepomi all booting the ball out on the full, while Contepomi over-cooked a kick to the left corner.
The Argentine playmaker did open the scoring after 15 minutes though with a well-struck penalty after Quins lock James Percival failed to roll away at a tackle.
But it was Quins who created the better chances, Evans sending Tiesi into space before a move broke down on the left flank, while David Strettle was denied in the right corner.
The intensity of a rip-roaring first half went up another notch with a thunderous attack through multiple phases, but Leinster's defence remained resolute, earning a penalty at its conclusion.
As Quins desperately sought a score before the interval, scrum-half Danny Care pulled a drop-goal attempt wide.
Instead Leinster doubled their precious lead, after coming close to the opening try following a moment of magic from O'Driscoll.
The celebrated centre chipped over the Quins defence into space, got the luck of the bounce and accelerated away to the line.
But Monye snagged him two metres short, and Strettle completed the salvage job by getting his body under the ball.
With Leinster players queuing up to score however, Quins number eight Nick Easter was sin-binned for a deliberate knock-down, Contepomi stroking over the penalty for a 6-0 half-time lead.
There was no let-up in a needle-tight contest on the resumption.
A Rob Kearney try in the right corner for Leinster was ruled out for a forward pass from Contepomi to Nacewa, before Kearney missed with a drop-goal attempt.
Quins lost the inspirational Evans to a thigh injury, but found themselves with a man advantage after 50 minutes when Contepomi was shown a yellow card for impeding a charging Chris Robshaw, moments after Easter had returned from the bin.
The hosts laid siege to the Leinster line only for Easter and Will Skinner to both suffer a dose of whitewash fever, while just before the hour Care pounced on a turnover and chipped ahead, only for Luke Fitzgerald to race back to the rescue for the Irish.
Quins then had a try disallowed by the video referee in the 62nd minute after a pile-up of bodies over the Leinster line.
Brown's try gave Harlequins hope
But they finally breached the visitors' defence with 14 minutes left when Brown finished off another onslaught after a dozen phases.
Malone, on for Evans, was unable to land the conversion though to leave Quins trailing by a point, and the replacement then had to go off himself to leave Brown as the third-choice kicker.
With eight minutes left, the full-back pushed a penalty wide, before Malone's replacement Tom Williams went off with a blood injury, sending a limping Evans back into the fray.
When Leinster hooker Bernard Jackman conceded a penalty with two minutes left that Quins kicked to touch in the corner, an expectant home crowd sensed another 'Stade Francais moment' in the making.
From the subsequent line-out Quins duly set up a potential match-winning chance, but this time Evans was unable to deliver the knock-out blow as his drop-goal attempt faded agonisingly wide.
Harlequins: Brown, Strettle, Tiesi, Turner-Hall, Monye; N Evans, Care; Jones, Botha, Ross, Percival, Robson, Robshaw, Skinner (capt), Easter.
Replacements: Malone for N Evans (47), J Evans for Percival (69), Williams for Malone (69). Not Used: Fuga, Lambert, Guest, Gomarsall.
Sin Bin: Easter (40).
Leinster: Kearney, Nacewa, O'Driscoll, D'Arcy, Fitzgerald; Contepomi, Whitaker; Healy, Jackman, Wright, Cullen (capt), O'Kelly, Elsom, Jennings, Heaslip.
Replacements: Not Used: Fogarty, McCormack, Hogan, O'Brien, Keogh, Dempsey, Horgan.
Sin Bin: Contepomi (51).
Ref: Nigel Owens (WRFU).