Fly-half Dan Biggar held his nerve with a 78th-minute conversion as Ospreys brought Leinster's 20-match unbeaten run to an end with a gutsy 23-22 comeback win at the RDS.
Hooker Richard Hibbard burrowed over in the right corner for a 77th-minute try which needed confirmation from television match official Alan Rogan.
That score brought the Welsh region to within a point and Biggar kicked the crucial match-winning conversion, with a kind bounce off the left hand upright.
Ian Madigan's opportunist try had given Leinster a decent 16-6 cushion at the break, with Fergus McFadden kicking three penalties and a conversion and Biggar responding with two penalties.
But McFadden could only add two more penalties to Leinster's tally as second-half tries from George Stowers and Hibbard inspired the visitors' fightback.