Leinster overturned a 17-point deficit in the final 15 minutes to steal victory from under the nose of Connacht in a dramatic and entertaining Guinness Pro 14 encounter in the RDS.
Connacht, seeking their first win away against Leinster since 2002, played superb rugby throughout, with Jack Carty scoring and creating tries out of nothing either side of half-time.
Carty's penalty shortly after the hour mark gave the westerners a 29-12 lead and it appeared a first away win at the venue was in the offing.
But Sean Cronin and Dan Leavy scored tries on the 59th and 61st minutes, teeing up a grandstand finish. Connacht defended desperately from there on but their decision-making would cost them as kept surrendering possession.
With the clock past 80 minutes, Leinster were camped on the Connacht five metre line, pummeling away at the green bank of defenders.
Eventually, a surge from the tight forwards saw Andrew Porter touch the ball down beside the post and George Clancy's arm shot in the air, sending the Leinster players and fans into raptures.
The burly Ireland prop scored at the end of a strength-sapping 41 phases, denying a heartbroken Connacht a sixth win on the trot and preserving Leinster's unbeaten home record this season.
The defending champions, showing 12 changes from last week's European victory over Bath, were 19-7 down at half-time as Connacht's electric attack produced tries from Cian Kelleher, Darragh Leader and man-of-the-match Jack Carty, who converted two of them.
Scores from Academy centre Conor O'Brien and Mick Kearney - the first of his provincial career - kept Leinster in touch, only for Caolin Blade to bag the westerners' 47th-minute bonus point and Carty added a penalty. However, Leinster's bench eventually had the bigger say with that breathtaking three-try finish.
Tiernan O'Halloran's late cry-off brought Bundee Aki into the visitors' line-up, fresh from his wedding to long-time partner Kayla. A slick move involving Carty and Aki off a maul opened up the Leinster defence and winger Kelleher's pace took him over in the far right corner with five minutes gone.
Following Carty's missed conversion, Leinster built pressure from a Hugo Keenan and Caelan Doris-led break before Jamison Gibson-Park sniped around the side of an 11th-minute ruck and sent the supporting O'Brien in under the posts. Ross Byrne converted for a 7-5 lead.
The momentum swung back to Connacht with Paul Boyle's relieving penalty and then Tom Farrell's inviting offload out of a tackle sending pacy full-back Leader scything through for a terrific 22nd-minute seven-pointer.
Blade went close to setting up Aki for a try soon after, with the terrier-like scrum half popping up everywhere.
It was Blade's rip in the tackle which launched Connacht forward for Carty's 33rd-minute try, captain Jarrad Butler's bulldozing carry gobbling up further yards before the fly-half's clever chip and collect saw him nip over beside the posts. Blade also foiled Rory O'Loughlin late attempt to score from his own kick through.
Leo Cullen's men were over the whitewash within three minutes of the restart, a strong 17-phase attack ending with Kearney muscling over from close range.
However, barely three minutes later, Carty's dummy and burst of pace through midfield saw him slice through to set up his half-back Blade for a deserved converted try.
Connacht were on the cusp of a famous win - their sixth in a row under Andy Friend - when Carty nailed a long-range 63rd-minute penalty, rewarding Shane Delahunt's speed at the breakdown. Crucially, Leinster kept their composure and patience as they wore down Connacht's defence in the tight and out wide.
The hosts had 10 internationals on the pitch in the closing stages, that experience proving telling as a scrum penalty and maul powered Cronin over in the 69th minute. Byrne converted and also brilliantly added the extras to Leavy's try two minutes later, the flanker crossing in the right corner after lovely interplay involving Adam Byrne, O'Loughlin and Scott Fardy.
What had seemed a unlikely win was now within Leinster's reach and despite the best efforts of Aki and company, Connacht could not hold out as the streetwise blue-clad pack picked and carried towards the posts before Porter provided a stunning end to his side's final home game of 2018.