Brendan Macken's last-minute try rounded off a satisfying first RaboDirect PRO12 win of the season for Leinster who downed the Newport Gwent Dragons at the RDS.
The sides shared out eight tries and 70 points on a hot September evening, with Ian Madigan landing seven kicks out of eight for an 18-point return.
Madigan helped Leinster take a 26-13 half-time lead as they sandwiched Steffan Jones' intercept try with efforts from Andrew Conway and Ben Marshall.
Shane Jennings and Fionn Carr touched down to seal the province's bonus point, but the Dragons drew some inspiration from Tom Prydie and Dan Evans scores.
Joe Schmidt's men hit back right at the death as Macken intercepted Evans' pass to race clear and in under the posts.
The Dragons, league leaders after the opening round, were looking for their first win in Ireland since 2008 and went in front thanks to a Prydie penalty.
But two sloppy restarts from the Welsh region allowed Leinster to score 10 points in a two-minute spell.
Jevon Groves infringed at a ruck, giving Madigan the chance to kick Leinster level and from the restart Noel Reid broke from deep to set up Conway's 7th-minute try.
Reid's superb slashing run cut the Dragons' rearguard wide open, with his centre partner Macken providing timely support, and a final pass sent winger Conway muscling over to the left of the posts.
Madigan converted for a 10-3 turnaround, only for the Dragons to snap back four minutes later with an intercept try from out-half Jones.
He picked off Reid's pass inside his own half and evaded John Cooney's grasp on a long sprint to the line.
Prydie supplied the extras to get the visitors back on terms, but Madigan's second penalty in the 16th minute and a rewarding scrum gave Leinster a welcome boost.
The Dragons, for their part, managed to build through the phases for a Jones drop goal effort that was well off target.
Leinster were penalised for holding on after a quick drop-out though, and Prydie sent the penalty through the posts.
Schmidt's men came storming back, Madigan landing a long-range penalty and then young flanker Marshall waltzed through for a try after two piercing carries from Sean Cronin.
The conversion and an injury-time penalty followed from Madigan, although a poor pass from Cronin spoilt a move that should have led to a third Leinster try.
The Dragons had prop Nathan Williams sin-binned just before the break for persistent infringing, and were guilty of some aimless kicking as Leinster increased their lead.
A rolling maul from a lineout sent Jennings over in the left corner and Madigan converted, and the bonus point was secured by Carr in the 49th minute.
Madigan jinked his way into space, setting the back-line in motion before looping back around to send Carr over out wide. His first missed kick followed at 38-13.
The Dragons responded with an equally impressive score, Pat Leach and Dan Evans darting away down the narrow side and putting Prydie clear for a five-pointer.
Another break down the blindside was rewarded in the 59th minute as Leinster's sloppiness was punished.
This time Prydie got free along the touchline and passed inside for full-back Evans who got away from Isa Nacewa to race in close to the posts.
Prydie added the extras to make it 38-25, with Darren Edwards' charges now playing with much more freedom - Andy Tuilagi was making his presence felt in midfield.
However, Leinster defended stoutly in the concluding minutes and Macken's break from his own half was a fitting way to round off an action-packed encounter.