Wales fly-half Dan Biggar kicked 20 points as Pro12 leaders Leinster went down to the Ospreys at the Liberty Stadium.
It made it a week to forget for the Irish province who were knocked out of the Heineken Cup by Toulon last Sunday.
Leinster had got back to 19-19 going into the last 10 minutes but Biggar, who had already kicked four penalties and a conversion, put over a drop goal andanother penalty to give the Welshmen a famous victory.
Ospreys had needed a win to keep up their challenge for a place in the top four and a spot in the end-of-season play-offs.
Leinster, who rested Brian O'Driscoll, began the evening with a five-point cushion over Munster in second place but had to settle for a losing bonus point.
Ospreys were without scrum-half Rhys Webb (knee surgery) and hooker Richard Hibbard (shoulder surgery) – both doubts for Wales' summer tour to South Africa.
Leinster looked the much stronger team early on as they took a 3-0 lead through outside-half Jimmy Gopperth on the 10-minute mark.
But a couple of cheap penalties allowed the home side into a 6-3 advantage with two Biggar penalties – one when scrum-half Isaac Boss was blown up for obstruction.
The business end of the first half produced two tries, one for each side.
Ospreys breezed into a 13-3 lead when wing Jeff Hassler was put over in the right corner, a score converted by Biggar.
But two minutes from the interval Leinster cut the deficit to only three points as they drove a line-out, with prop Cian Healey emerging from a pile of bodies as the scorer; Gopperth converted.
Ospreys, with Dan Baker playing well at No. 8, were given some breathing space at the start of the second half when two Biggar penalties on 43 and 49 put them 19-10 in front.
But Leinster edged their way back on level terms Gopperth putting over three consecutive penalties.
It made for a grandstand finish but Ospreys were back in front again with a neat Biggar drop goal from the 22 line.
And he followed that up three minutes from time with a penalty that left Leinster more than a little frustrated.