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.
England's preparations for the Autumn International series were potentially dealt a further blow as Maro Itoje was forced to undergo an x-ray after Saracens' European victory over Scarlets on Saturday night.