Phil Godman kicked a last-minute conversion as Edinburgh sealed a bonus-point 32-30 victory against the Ospreys at the Liberty Stadium.
Godman converted Jim Hamilton's try after the Ospreys had led 30-25.
But despite the defeat, a try bonus point and a losing bonus point keep the Ospreys in with a mathematical chance of taking the Magners League title even though leaders Munster are 14 points ahead.
The Ospreys included five of their six Lions - Shane Williams, Mike Phillips, Lee Byrne, Tommy Bowe and Adam Jones - with Alun Wyn Jones rested.
Edinburgh have no Lions representatives as yet but captain Mike Blair was looking to impress after Munster's Tomas O'Leary was ruled out of the tour to South Africa after suffering a broken ankle against the Scarlets on Friday night.
Peter O'Mahony was named man of the match against England last month
21 April 2017, 7:22pm
Peter O'Mahony's performance in the RBS 6 Nations finale for Ireland against England was crucial to his selection for the British & Irish Lions on Wednesday, Ireland and Lions defence coach Andy Farrell has revealed.