The Ospreys staged a stunning finish with two late tries to squeeze home against Edinburgh.
Edinburgh: (7) 31
Tries:Southwell 2, Joiner, D. Hall.
Cons: Monro 4.
Ospreys: (15) 35
Tries: Terblanche, Storey, Millward, Pugh.
Cons: Henson 3.
Andy Millward and Richard Pugh both charged over the line in the dying stages, with their efforts converted by the impressive Gavin Henson.
James Storey and Stefan Terblanche scored first half tries for the visitors at Meadowbank.
Edinburgh matched the try-count for a bonus point but were edged out by the kicking of Henson.
The home side's tries came from Hugo Southwell (2), Dougie Hall and Craig Joiner.
Both sides made mistakes in the untidy opening sparring session before Edinburgh seized control.
They were left frustrated, however, when Marcus Di Rollo spilled the ball with the line at his mercy in the wake of slick work by Mike Blair.
Blair was back in the spotlight to help set up the first try for winger Southwell, who found extra strength to stretch to the target after being blocked short.
Ander Monro confidently slotted the conversion - only to see the Ospreys burst back into the contest.
Shaun Connor sent the home defence into a flap with a beautifully-weighted crosskick for Terblanche to gather.
And following a bout of quick inter-passing it was centre James Storey who claimed the try.
Gavin Henson missed the conversion but made amends with a penalty shortly afterwards.
Even worse was to come for Edinburgh six minutes before the break when Terblanche ploughed over for try number two, goaled by Henson.
Edinburgh came to life immediately after the restart as they created two great tries to seize the initiative.
Hall drove over following powerful work by captain Nathan Hines - then Southwell sprinted out of his own danger-zone to collect his own chip and score. Monro added both goals.
Henson (two) and Monro then swapped penalties as the match entered the final quarter.
And when Joiner darted over to make sure of the bonus point, with Monro converting, the Ospreys challenge appeared to be over.
But late touchdowns from Millward and Pugh, converted by Henson, left the home crowd stunned.
Edinburgh: Derrick Lee, Hugo Southwell, Marcus Di Rollo, Matt Dey, Craig Joiner, Ander Monro, Mike Blair, Tom McGee, Dougie Hall, Ramin Mathieson, Nathan Hines (captain), Alastair Kellock, Alasdair Strokosch, Simon Cross, Andrew Dall.
Replacements: Carlo Di Ciacca, John Cox, Guy Perrett, Craig Harrison, Rory Lawson, Alistair Dickson, Malcolm Clapperton.
Ospreys: Henson, Terblanche, Storey, Tiueti, Seveali'l, Connor, Williams, Griffiths, Williams (capt), Millward, Newman, Tait, Bater, Lloyd, Tandy.
Replacements: Durston, Wells, Wells, Evans, Bateman, Bonner-Evans, Pugh.
Referee: Alain Rolland (Ireland).