The new skipper has had a championship to forget so far after costly mistakes in the defeats to Ireland and England.
But he went some way to atoning for those blunders as his 20th Test touchdown opened the scoring in a 17-0 win in Rome.
The Dark Blues were again guilty of failing to take their chances but Chris Harris and Adam Hastings also got on the scoresheet at the Stadio Olimpico to give Townsend some respite after a bruising tournament overshadowed by the Finn Russell row.
That bust-up with Scotland's star man, combined with last year's early World Cup exit and six games without a win in the Six Nations, had placed the head coach under increasing scrutiny but his team will now welcome France to Murrayfield in a fortnight with confidence renewed after a deserved victory.
Scotland had failed to register a try in either of their two opening defeats despite having more than enough chances.
And the travelling Tartan Army in the Eternal City must have feared their side were set for a fresh bout of white-line fever as another chance went begging eight minutes in.
A monster 60-yard kick from Hogg forced a line-out deep into the Azzurri's 22 but while the hosts were caught out by Stuart McInally's long throw for Sam Johnson, they were back in position to hold up Hogg before a knock-on from Magnus Bradbury saw the Scots come frustrated yet again.
The Dark Blues' scrum was working well and a big shunt should have been rewarded with an easy three points. Adam Hastings, however, shanked a simple kick almost in front of the sticks.
It was a sloppy start from Townsend's team and it almost became a disastrous one as another poor swipe of Hastings' boot released Mattia Bellini. The Zebre wing danced past three tackles before storming up field, with Jayden Hayward only prevented from scoring by Hogg's last-ditch tackle.
But it was Scotland who at last found a breakthrough in the 23rd minute.
Blair Kinghorn put Matteo Minozzi under pressure with a well-placed kick and he could only respond by firing straight at Jamie Ritchie in centre-field. The flanker handed off to Hogg and the skipper did the rest, rampaging through a gap in the hosts' line before striding away from Hayden to score a sensational try.
It was a moment of redemption for the relieved captain as he was pounced upon by his jubilant team-mates after hitting back at those who have suggested the armband might be too heavy for him.
Hastings missed the conversion but Scotland thought they had a second try on the half-hour mark as Ali Price scampered in under the hosts but the celebrations were cut short when the TMO alerted referee Ben O'Keeffe to Hamish Watson's forward pass in the build-up.
But Scotland were still being wasteful, with Price and Ritchie again letting the ball slip through their fingers with the line in sight either side of the turnaround.
They did not lose heart though and got their reward in the 47th minute. There were times during 17 phases of sheer grunt on the Italian line where Italy's resistance looked like it might pay off but in the end there was just enough space for Harris to squeeze through wide on the right for the second. Again Hastings failed to convert.
Italy had to play out the final stages a man light after Federico Zani was binned for a tip-tackle on Grant Gilchrist.
And with their legs tiring they could do nothing as Hastings pick-pocketed a ruck before cantering in under the posts to put the seal on a much-needed win for Scotland and their coach.