Despite a tense finish in which Cardiff pressed for a match-winning try, the hosts' defence held firm to close out the result.
The visitors' only second-half points came via an Ioan Lloyd penalty in the 73rd minute, capping a period of sustained pressure in an otherwise scoreless half that still carried high intensity throughout.
The Sharks had built their advantage before the break, taking a 21-12 lead into half-time. Yaw Penxe's opportunistic try - a clever kick ahead and regather - extended their cushion, with Jordan Hendrikse adding the extras.
Earlier, Phepsi Buthelezi proved decisive with a brace. His first came after Jason Jenkins charged down a Cardiff clearing kick, forcing the visitors to scramble near their own line before the Sharks capitalised through a lineout and maul.
Hendrikse converted to open the scoring. Buthelezi struck again in the 32nd minute, powering through from another attacking lineout, with Bradley Davids converting to make it 14-12 at the time.
Cardiff had briefly taken control midway through the first half. Mason Grady crossed twice - first on the right wing after sustained possession, converted by Callum Sheedy, and again via a well-executed cross kick while the Sharks were down to 14 men following Hendrikse's yellow card for a deliberate knockdown.
After a scrappy opening spell filled with basic errors, both sides found rhythm, but it was the Sharks - aided by early front-row changes from coach JP Pietersen - who ultimately did enough to secure the win.