Ulster scored three tries but may rue not getting a fourth and a valuable bonus point in the 24-21 success.
After a frantic start where both sides were throwing the ball about without much structure, it was Ulster that fashioned the first chance as skipper Iain Henderson forced a penalty on the Sharks 22 and out half John Cooney slotted over the kick on 17 minutes.
Ulster’s first sustained period in the Sharks’ 22 resulted in the game’s opening try on 26 minutes.
The Durban side conceded a penalty, Ulster went to touch, the visitors stopped the maul before Cooney spun it inside, Stuart McCloskey made the hard yards, Billy Burns spotted space out wide and looped a long-range pass to Ethan McIlroy.
The winger stepped inside, wrong-footing two defenders before off-loading to Michael Lowry and the full back crossed from close range. Cooney landed the conversion.
The Sharks’ first opportunity for points came on 35 minutes when the pack forced a scrum penalty but out half Curwin Bosch’s long-range effort drifted wide and Ulster went into the interval with a 10-0 advantage.
Ulster struck three minutes after the restart.
After scrappy phase play, Cooney flicked a poor pass to Burns, the out half picked it off his boot laces and released Tom O’Toole, who fed Iain Henderson.
The skipper gave it to McCloskey, he bulldozed his way through two tackles to go under the posts and Ulster’s scrum half converted.
The Sharks were camped inside the Ulster two and despite having two penalties when they opted for scrums, they couldn’t breach the well-drilled home defence.
The Sharks finally opened their account on 62 minutes, again Ulster’s discipline in the shadow of their own posts let them down.
The South African side abandoned their scrum and went for the tap penalty, replacement loose head prop Ntuthuko Mchunu took it and blasted through Rob Lyttle to touch down, with Bosch adding the conversion.
Ulster responded immediately - Robert Baloucoune finally got to stretch his legs by sprinting down the touch line, he switched the ball inside to Cooney and the scrum half put centre James Hume under the posts, making the conversion a formality.
Cooney made an important try-saving contribution on 70 minutes.
South African World Cup winger Makazole Mapimpi got the ball in space and sped past Baloucoune to carry deep into Ulster territory, he switched the ball inside to replacement scrum half Grant Williams but Cooney snaggled him and Matty Rea was able to get over the ball and win a penalty.
The Sharks got their second try on 75 minutes when from a lineout just inside the Ulster half Williams received ball off the top, the scrum half sold a dummy, sprinted through the gap and put centre Marius Louw under the posts, with Boeta Chamberlin slotting the extras.
The Sharks set up a nail-biting finish with a third try with 90 seconds remaining as Williams, in his own 22, chipped over the on-rushing Ulster defence, Louw gathered and fed his scrum half, who had enough pace to go all the way to the try line from long distance, with Chamberlin converting.
But Ulster survived.
Ulster: M Lowry, R Baloucoune, J Hume, S McCloskey, E McIlroy, B Burns, J Cooney, A Warwick, R Herring, T O’Toole, A O’Connor, I Henderson (capt), Marcus Rea, N Timoney, D Vermeulen.
Replacements: J Andrew for Herring 75 mins, E O’Sullivan for Warwick 55 mins, G Milasinovich for O’Toole 55 mins, K Treadwell for O’Connor 55 mins, Matty Rea for Vermeulen 65 mins, N Doak for Cooney 78 mins, S Moore for Hume 71 mins, R Lyttle for Lowry 31 mins.
Sharks: A Fassi, W Kok, L Am, M Louw, M Mapimpi, C Bosch, J Hendrikse, O Nche, B Mbonambi, T du Toit (capt), R van Heerden, R Hugo, S Kolisi, H Venter, P Buthelezi.
Replacements: K van Vuuren for Mbonambi 66 mins, N Mchunu for Nche 55 mins, K Mchunu for du Toit 71 mins, H Andrews for Hugo 59 mins, J Labuschagne for Buthelezi 74 mins, S Notshe for Venter 66 mins, G Williams for Hendrikse 59 mins, B Chamberlain for Bosch 74 mins
Referee: B Blain (SRU)