Captain Justin Tipuric clinched a late triumph for the Ospreys as the young Wales flanker scored in injury time to beat battling Edinburgh in the Pro12.
Tim Visser gave the Scottish side the lead as Ospreys full-back Richard Fussell misjudged the bounce of the ball and the Dutch wing touched down.
Scrum-half Rhys Webb scored to drag the Ospreys back into the game while Dan Biggar and Greig Laidlaw traded kicks.
But at 19-all, Tipuric finished an Ospreys counter to win the game late.
A losing bonus point was the only consolation for a disappointed Edinburgh side as the Welsh region maintained their 100 percent start to the league season.
Edinburgh, without seven players on Rugby World Cup duty in New Zealand, broke the deadlock against the run of play on six minutes after Fussell over-ran Laidlaw's chip ahead and Visser capitalised on the error.
The Ospreys, minus eight players at the World Cup, hit back with a stunning try from in-form Webb, who weaved his way over from a line-out on the 22.
Edinburgh immediately regained the lead with a Laidlaw kick but Biggar locked the scores at 10-10 with a penalty from in front of the posts.
Then the hosts wasted chances to go ahead when Biggar's drop-goal was ruled out by referee David Wilkinson before Tipuric spilled the ball in the act of scoring.
But the Ospreys went into the lead after 31 minutes when Biggar slotted a penalty from a maul infringement by flanker Sean Cox.
The Ospreys suffered a frustrating end to the first half as firstly Irish referee Wilkinson got in the way of an encouraging attack, then Kristian Phillips attempted a rather over-ambitious drop-kick.
But Edinburgh scrum-half Laidlaw levelled the match with a penalty on the stroke of half-time.
Edinburgh conceded a penalty just 51 seconds into the second half but Biggar's shot at goal rebounded off the left upright.
By contrast Laidlaw kicked his effort after 45 minutes to give Edinburgh a 16-13 lead.
A minute later Biggar had found the target to tie up the scores at 16-16 with his third penalty.
Biggar kicked another penalty to give his side a 65th minute 19-16 lead when Edinburgh failed to roll away.
Laidlaw levelled the scores when Ospreys lock Ian Evans was sin-binned from a line-out offence.
The match seemed destined for a draw until Tipuric squeezed over in the second minute of injury time as the young captain lead by example.
Ospreys: Richard Fussell; Kristian Phillips, Andrew Bishop, Ashley Beck, Hanno Dirksen; Dan Biggar, Rhys Webb; Duncan Jones, Mefin Davies, Cai Griffiths, Ian Gough, Ian Evans, Tom Smith, Jonathan Thomas, Justin Tipuric (capt).
Replacements: Scott Baldwin, Aaron Jarvis, Joe Rees, James Goode, James King, Tom Isaacs, Matthew Morgan, Sonny Parker.
Edinburgh: T Brown, S Webster, M Scott, J King, T Visser, G Hunter, G Laidlaw (capt), K Traynor, S Lawrie, L Niven, G Gilchrist, E Lozada, S Cox, R Grant, D Denton.
Replacements: A Kelly, R Hislop, S Knight, S Turnbull, H Watson, C Leck, J Thompson, L Jones.
Referee: David Wilkinson (IRFU)
Assistant Referees: James Jones, Ian Davies (WRU)
Citing Commissioner: John Charles (WRU)
TMO: Tony Rowlands (WRU)