Returning fly-half Stephen Myler helped Ospreys defeat United Rugby Championship leaders Edinburgh to end a five-match losing streak.
Ospreys battled back from a 14-0 deficit with tries from full-back Mat Protheroe and hooker Sam Parry and 13 points from Myler's boot.
South African prop Boan Venter scored a hat-trick for the Scottish side but it proved in vain.
Edinburgh are left still searching for a first victory in Swansea since 2009.
Myler returned from a rib injury after almost a two-month break and partnered captain Rhys Webb, with the half-back pair expertly helping to orchestrate the Ospreys fightback.
Morgan Morris made an impressive impact from the replacements bench while fellow back row Ethan Roots was outstanding.
Both sides were without leading internationals as Ospreys made changes from the depleted side beaten by Sale to end their Champions Cup campaign.
Scotland internationals Jaco van der Walt, Henry Pyrgos, Dave Cherry, Marshall Sykes and Magnus Bradbury started for Edinburgh, with nine changes to the side that hammered Brive in the Challenge Cup.
Wing Darcy Graham was released from Scotland's Six Nations camp to start, while Jamie Hodgson, Ben Vellacott and Mark Bennett came off the replacements' bench.
Ospreys lock Lloyd Ashley was shown a yellow card for tripping Edinburgh full-back Henry Immelman by referee Andrea Piardi.
Edinburgh took advantage with two tries for prop Venter, both converted by Van der Walt.
The first try was a short-range effort, while the second was an expert finish following powerful build-up play from centre Cammy Hutchinson and number eight Mesu Kunavula.
Myler responded with a penalty as Edinburgh led by 11 points at half-time.
Ospreys head coach Toby Booth was visibly bemused with some of the referee's interpretations as he remonstrated with an official on the sidelines, but would also have been frustrated by his side's inaccuracy.
That improved straight after the break when full-back Protheroe dived over from a Michael Collins offload, with Myler converting.
Gareth Anscombe, released by Wales coach Wayne Pivac from the Six Nations squad to play, came on as a replacement and slotted in at full-back with Protheroe switching to wing.
Kunavula avoided a yellow card for a late tackle on Myler but his offence provided the platform for Ospreys to score their second try from a well-worked lineout move as impressive replacement number eight Morris fed hooker Parry.
Edinburgh responded with Venter's third try as he again powered over following sustained pressure before wing Luke Morgan charged down Van der Walt's conversion attempt.
Ospreys regained the lead with two late Myler penalties as the hosts held on for a vital and deserved victory.
It proved extra special for the Welsh region as it was achieved on the birthday of hooker Ifan Phillips, who had a leg amputated after a road traffic collision involving two motorcycles in December 2021.
Ospreys head coach Toby Booth told BBC Sport Wales: "We have missed the crowds and everybody saw the influence of it. We have to earn the right to get the crowd into it and we did that, especially in the second half.
"There was a bit of stunned silence in the first half for obvious reasons but it is an 80-minute game and we won a lot of key moments in the second half and crafted a win.
"With 21 people unavailable you need leadership and strategy and Stephen Myler and Rhys Webb helped marshal the team expertly.
"It was Ifan Phillips' birthday today and that can't get lost. It was a significant moment and the boys talked about it in the build-up and it showed the team spirit is still alive and kicking."
Edinburgh head coach Mike Blair: "We are disappointed, we did enough to win - certainly in the first half - putting them under a lot of pressure with our kicking game.
"We had the upper hand with the Ospreys not challenging us when playing from deeper, so I was disappointed that in the second half we gave them some easy ins.
"It does not come down to one thing, but I thought we had found weaknesses in the opposition but did not stick to that.
"It can be a bit mixed when you have guys coming back in but that is not an excuse, we had a team out there which could have won the game but we did not execute."
Ospreys: Protheroe; Giles, Collins, Williams, Morgan; Myler, Webb (capt); Smith, Parry, Botha, Davies, Ashley, Griffiths, Deaves, Roots.
Replacements: Taione, Jones, Henry, Sutton, Morris, Morgan-Williams, Anscombe, Thomas-Wheeler
Edinburgh: Immelman; Graham, Currie, Hutchison, Boffelli; Jaco van der Walt, Pyrgos (capt); Venter, Cherry, Williams, Sykes, Young, Bradbury, Boyle, Kunavula.
Replacements: McBurney, Courtney, Atalifo, Hodgson, Muncaster, Vellacott, Savala, Bennett.
Referee: Andrea Piardi (FIR)
Assistant referees: Gwyn Morris (WRU), Mike English (WRU)
TMO: Ian Davies (WRU)