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.