Dragons inflicted more misery on Ospreys in the final Welsh derby of the festive period.
Late tries from man of the match Rio Dyer and replacement Adam Warren snatched victory after an earlier try from Wales prop Leon Brown.
Former Ospreys outside-half Sam Davies added 10 points.
Ospreys scored through the returning George North and centre Tiaan Thomas-Wheeler, although North was later forced off with injury.
It will be a concern for Wales coach Wayne Pivac ahead of the Six Nations, along with Ospreys captain Justin Tipuric who also limped off.
Ospreys had led 18-13 going into the final exchanges of a low-quality affair, but it was typical of a disastrous season for the region with this defeat representing an 11th successive loss and 13 in 14 matches.
North was playing for the first time since the world cup semi-final against South Africa during which he ruptured a hamstring. Hooker Sam Parry also returned from injury, while Scott Williams recovered from the facial injury he suffered against Scarlets.
Fly-half Marty McKenzie dropped to the replacements' bench to make way for Luke Price.
Dragons made five changes to the team that lost to Cardiff Blues, with Wales pair Leon Brown and Elliot Dee handed starting spots. Ross Moriarty also returned after recovering from a dead leg.
There were two late alterations with wing Ashton Hewitt (calf) and Wales lock Cory Hill (illness) ruled out and replaced by Dyer and Matthew Screech.
Dragons outside-half Davies, playing for the first time against his former region, saw his opening penalty attempt hit the post, before North marked his return with a try thanks to a clever kick from Williams.
Davies and Price exchanged penalties before Brown hit a great inside line and sprinted over from 30 metres. The try was awarded by referee Andrew Brace after Dee's pass looked forward. Davies converted to give the hosts a 10-8 interval lead.
Both 10s added another penalty apiece at the start of the second-half before replacement hooker Scott Otten rose briefly above the mediocrity with a charging run.
This helped lay the eventual platform for Thomas-Wheeler to cross under the posts for a converted try. Ospreys were inspired and number 8 Morgan Morris was held up over the Dragons line after a couple of rampaging breaks.
North later moved into the centre with Williams replaced by Hanno Dirksen.
Wales backs coach Stephen Jones would have been an interested observer in the Rodney Parade crowd ahead of the Six Nations as he considers the midfield injury problems.
Price missed a chance to extend Ospreys lead to two scores with a missed penalty as the Dragons launched a dramatic late revival.
Dyer claimed Davies' clever cross kick to level the scores and while the conversion was missed, it mattered little as Warren scored a runaway try to seal the win after Price's kick had been charged down.
Dragons wing Rio Dyer told BBC Sport Wales: "It's a team game and I wouldn't have got man of the match if it wasn't for the team effort so I'm happy for everyone.
"They came down here trying to prove something with a losing streak at the moment and they weren't going to give in, so we had to fight for the 80 minutes.
"It was an amazing feeling to get my first senior try, I was waiting for that (chance) for the whole game so I was just really happy.
"It was a bit of football skill from Adam Warren (for the winning try), he's been watching Lionel Messi I think, and it was a well-taken try."
Dragons: Talbot-Davies; Rosser, T Morgan, T Griffiths, Dyer; S Davies, R Williams (capt); Harris, Dee, L Brown, J Davies, Screech, Wainwright, Basham, Moriarty.
Replacements: Hibbard, Jarvis, Fairbrother, M Williams, Keddie, Knoyle, Botica, Warren.
Ospreys: C Evans; North, Thomas-Wheeler, S Williams, L Morgan; Price, A Davies; N Smith, Parry, Fia, Beard, B Davies, Cracknell, Tipuric (capt), M Morris.
Replacements: Otten, Marfo, Gardiner, Lydiate, Cross, Venter, McKenzie, Dirksen.
Referee: Andrew Brace (Ireland).
Assistants: Ben Whitehouse (Wales) & Paul Haycock (Ireland)
TMO: Brian MacNeice (Ireland).