Jamison Gibson-Park's 73rd-minute try helped Leinster to seal a 21-13 victory over Edinburgh in the Guinness PRO14 at the RDS Arena.
Leinster turned a miscued Blair Kinghorn clearance into the game's key score, with Gibson-Park's fellow replacement Ross Byrne converting from out wide as the hosts got back to winning ways.
Jason Tovey did all of Edinburgh's scoring, kicking two early penalties and running in a 30th-minute intercept try as they trailed 14-13 at half-time.
Struggling to improve on last week's lacklustre display against the Cheetahs, Leinster were fortunate to be in front, with man-of-the-match Jonathan Sexton converting Joey Carbery's try to add to Jordi Murphy's earlier effort.
Sexton was one of four returning Lions back in blue, but Leinster left a number of scores behind them, especially when Edinburgh's Jamie Ritchie was in the sin-bin. There was relief for the home crowd when Gibson-Park and Byrne made certain of the victory.
Edinburgh deserved more than Tovey's fourth-minute penalty such was the quality of their start, with James Johnstone standing out.
The one-way traffic saw Tovey split the posts with two penalties inside the opening 10 minutes. Nonetheless, Leinster replied from their first serious attack, a leaping Dave Kearney drawing a penalty before Sean Cronin went close from a maul and then flanker Murphy muscled over for Sexton to convert.
Tempers flared between Darryl Marfo and Scott Fardy, sparking a brief scuffle between the teams. Leinster remained on the front foot until Cronin dropped the ball in a maul and Carbery knocked on in contact back near halfway.
Just when it seemed like Leinster's Lions were beginning to wield more influence, Tovey stepped in to snap up Sexton's intended pass for Cronin and dart clear for a superb 70-metre try which he converted himself.
Edinburgh had Tom Brown to thank for a despairing tackle which robbed Fardy of a certain Leinster try, however that score eventually came in injury-time. The visitors gave away three penalties in their 22 before Carbery jinked near the right corner.
Sexton nailed the difficult conversion to nudge his side in front. Leinster held onto the momentum - Tadhg Furlong and Murphy combining brilliantly on an early second-half raid - until Jack McGrath was denied a few metres out.
Hamish Watson won a relieving penalty at the breakdown, but his back row colleague Ritchie saw yellow for taking out Luke McGrath late after the scrum-half had kicked clear.
Edinburgh's resilient defence came good again, holding Jack McGrath up past the try-line and then Sexton's grab of Sam Hidalgo-Clyne around the neck saw him penalised and Leinster sent back towards halfway.
The Scots found a second wind after some breathless passages of play either side of the hour mark. They countered impressively after Leinster had coughed up hard-earned territory due to Bryan Byrne's lineout errors.
Edinburgh replacement Anton Bresler charged up into the hosts' 22 before Dougie Fife had a try ruled out for obstruction by Cornell du Preez.
The second-half deadlock was finally broken when Byrne's kick forced Kinghorn into a hurried clearance, the ball gobbled up by the leaping Max Deegan and Gibson-Park pounced from the ruck for the crucial seven-pointer.
The fast-breaking Kinghorn tried to make amends late on but the Scots had nothing to show for a valiant performance.