Dragons were denied back-to-back wins as Sharks fought back to secure a late victory at Rodney Parade.
Dragons edged a physical but disjointed first half, leading 12-6 thanks to four penalties from fly-half Will Reed.
The hosts scored the game's first try as Elliot Dee touched down at the back of a well-constructed rolling maul.
Grant Williams intercepted Angus O'Brien's pass to cross for Sharks before Thaakir Abrahams' converted try snatched a narrow win.
Losing in such a manner was cruel on Dragons, who deserved more after a wholehearted performance in trying circumstances.
Head coach Dai Flanagan was still in charge with Dean Ryan's departure as director of rugby yet to be finalised, though that uncertainty did not appear to unsettle the Gwent region.
Flanagan had overseen an impressive 23-17 win over Munster last weekend, the Dragons' first home victory for 17 months.
With relatively high hopes of back-to-back wins at Rodney Parade for the first time since 2020, the hosts started energetically against their South African opponents, who were without their Springbok stars.
Wales second rows Will Rowlands and Ben Carter led a powerful Dragons forward effort, though neither backline was able to play fluently in a first half with plenty of endeavour and full-blooded collisions - but an equal abundance of handling errors.
The scoring in the first half was therefore left to the fly-halves, with four Reed penalties to two from his Sharks counterpart Boeta Chamberlain giving Dragons a 12-6 lead.
The hosts' backs burst into life at the start of the second half as wing Rio Dyer and full-back O'Brien cut through the Sharks' defence in an attack which led to a penalty Reed kicked to the corner.
Dee controlled the subsequent maul and plunged over from close range for a try which Reed converted smartly from the left.
Mauls looked like the Sharks' best route back into the game as they drove towards the Dragons' try line, but the home defence was disciplined and determined not to yield.
That drew roars of approval from the noisy Rodney Parade faithful, who also enjoyed their team's combative counter-rucking which disrupted their opponents' attempts to attack.
They were momentarily silenced, however, when Sharks scrum-half Williams intercepted O'Brien's pass and scampered clear to score a converted try which reduced the visitors' deficit to 19-13.
With six minutes remaining, a spell of Sharks pressure told and wing Abrahams ran over for a try which brought his side within a point of Dragons' tally.
Chamberlain's successful conversion put the visitors ahead and, although the fly-half missed a late penalty, his side held onto their lead to secure a second win from their first two matches of the season.
Dragons head coach Dai Flanagan said:
"Our effort was outstanding all game. That's life, no-one likes losing but we'll pick ourselves up, dust ourselves down and go again.
"A six-day turnaround [from last Sunday's win over Munster] is really difficult to go against a team as physical as these, so we had to nail our recovery and prep and I think we did that.
"What's really pleasing for me is how much more we've got. These are good players and we need to believe there's plenty more in the tank for us."
Dragons: Angus O'Brien; Rio Dyer, Sio Tomkinson, Jack Dixon, Ashton Hewitt; Will Reed, Rhodri Williams; Aki Seiuli, Elliot Dee, Lloyd Fairbrother, Ben Carter, Will Rowlands (capt), George Nott, Taine Basham, Ross Moriarty.
Replacements: Bradley Roberts, Rob Evans, Chris Coleman, Joe Davies, Aaron Wainwright, Lewis Jones, Max Clark, Jordan Williams.
Sharks: Aphelele Fassi; Werner Kok, Rohan Janse van Rensburg, Ben Tapuai, Thaakir Abrahams; Boeta Chamberlain, Grant Williams; Ntuthuko Mchunu, Kerron van Vurren, Thomas du Toit (capt), Justin Basson, Reniel Hugo, James Venter, Dylan Richardson, Phepsi Buthelezi.
Replacements: Dan Jooste, Dian Bleuler, Carlu Sadie, Hyron Andrews, Sikhumbuzo Notshe, Cameron Wright, Marnus Potgieter, Anthony Volmink.
Referee: Ben Blain (SRU)
Assistant referees: Gwyn Morris & Elwyn Morris Roberts (WRU)
TMO: Sam Grove-White (SRU).