The Sharks saw off the Cheetahs in Bloemfontein to pick up the win they needed to maintain their Super Rugby play-off hopes.
The home side, with little to play for, led 11-6 at half-time at Free State Stadium - with Sarel Pretorius' try making the difference as both teams kicked two penalties.
However, Lwazi Mvovo and JP Pietersen crossed in the second half to give the Durban-based team a victory which improves their chances of post-season action, despite another try from Riaan Viljoen just before the end.
The first half was intensely fought, with Patrick Lambie opening the scoring with a 12th minute penalty.
However scrum-half Pretorius was able to round off a move involving Viljoen and Ashley Johnson to give the home side the edge, although Sias Ebersohn's attempted conversion hit the posts.
Ebersohn kicked a penalty five minutes later and did the same after Viljoen had missed one for the visitors in the 28th minute, before Lambie rounded off the first half scoring with a 37th-minute penalty.
The Sharks took control of the contest early in the second half with 10 unanswered points.
After Lambie had kicked a 43rd-minute penalty, Mvovo scored their first try with a long-range effort which started in his team's own 22 off turnover ball and finished 80 metres upfield with a great solo effort from the wing. Lambie converted to give his team a 16-11 lead.
Then Adi Jacobs, with his first touch of the ball, dummied the defence and slipped through for the break that would lead to his team's second try, with Meyer Bosman also involved before Pietersen scored in the corner.
Lambie's conversion gave the Sharks a 12-point lead with 10 minutes of the game remaining.
However, Viljoen pulled his team right back into the contest in the dying minutes as the Sharks fell foul of the officials, with Charl McLeod sent off for repeated infringements and Keegan Daniel following for kicking the ball away.
Ebersohn's conversion meant there were just five points separating the teams - but time was not on their side and the Sharks were able to hold out and earn reward for one of their best defensive efforts of the season.