It was the proverbial game of two halves with the Sharks, whose coach John Plumtree left in midweek, dominating the opening 40 minutes with the physicality of their pack and monopolising possession and territory.
The Blues hit back in the second period, scoring 15 unanswered points for what looked like a crucial victory in their bid to reach the playoffs.
Trailing by three points, the Sharks, after turning down kickable penalties, were rewarded with a try in the corner from fullback Viljoen just before the final whistle.
"We kicked poorly at times, they are dangerous when they have that type of ball in hand, but the boys hung in there and defended hard," Sharks captain Keegan Daniel said in a TV interview.
"We were playing for this union and these players, we have been through a lot in the last couple of weeks with all the changes that have been happening. It has been tough at times, it can either unite a team or break a team, we showed today we are united."
The Sharks looked in complete control as they scored tries through Marcell Coetzee and Charl McLeod, but the Blues hit back with Frank Halai getting a brace and Rene Ranger a third.
Coetzee and McLeod both profited from strong work from the forwards off the back of the lineout before the Blues eventually managed to set some good attacking platforms, sending Halai over towards the end of the first half.
The Durban-based outfit led 17-5 at the break and were seemingly in control of the game.
However the Blues found a foothold in the second half and their expansive style stretched the Sharks team that suddenly looked fragile and panicked, kicking away possession.
After Halai ran in unopposed for his second replacement Ranger scored a third try for the visitors that was converted by Chris Noakes, levelling the scores 17-17.
A penalty to Baden Kerr just past the hour-mark edged the Blues in front, but the Sharks kept pounding the line and were rewarded with the match-winner from Viljoen.
"We had no ball in the first half, we just said if we could get our hands on the ball the momentum would slowly shift," Blues captain Ali Williams said.
"That's what happened, when we had the ball we were pretty good on attack."
- Sports & Recreation