A penalty each from Steffan Jones and Jason Tovey had kept the Dragons in touch, and in a disjointed second half Tovey closed the gap to five points.
Indiscipline crept into Munster's play - Mafi and Peter O'Mahony were both sin-binned for ruck offences and Damien Varley saw yellow for a slap - but a late penalty from new signing Ian Keatley sealed the victory.
There were some nice early touches from Keatley and Peter Stringer, while a well-executed lineout allowed the Dragons to launch Mike Poole up the left wing.
Solid defending and a clutch of errors kept the game scoreless, despite some forceful bursts from the likes of Gavin Thomas and Tom Brown.
Keatley missed a kickable penalty on the quarter hour mark and it took a monster effort from young full-back Jones to open the scoring for the Dragons.
He launched the ball through the posts from just inside his own half, only for Munster to win a penalty from the restart which Keatley popped over to level.
Tony McGahan's men tore through the Dragons defence for a superb try four minutes later.
Johne Murphy was sent charging over halfway and although Adam Hughes hauled him down just short of the line, Barnes timed his run perfectly to gather Murphy's pass and score.
Keatley converted and also added the extras to Mafi's 37th minute effort. Billy Holland put Denis Hurley charging away from the tail of a lineout and Mafi was up in support to ghost in behind the posts.
The Dragons, with Jones showing good positional sense, hit back on the stroke of half-time with a close range penalty from Tovey.
The Welshmen lost prop Ben Castle to the sin-bin for not rolling away, two minutes after the resumption, but Keatley drew his 45-metre penalty to the right and wide.
The numbers were evened up briefly when Mafi picked up a yellow card for the same offence as Castle's, amid a spell of defence-dominated play.
The Dragons managed to seal off the danger as Doug Howlett broke free on the right, and Tom Willis and his colleagues maintained a high work-rate, particularly at the breakdown.
Although Hughes broke into the Munster 22, Darren Edwards' charges could not get within sight of the whitewash.
They had to rely on Tovey's boot, with his brace of penalties clawing the deficit back to 17-12 with 11 minutes remaining.
Munster were down to 13 players at that stage, as stand-in captain O'Mahony and Varley were sin-binned within five minutes of each other.
But there was no panicking from the men in red, particularly with James Coughlan and Niall Ronan coming up with some vital plays.
Keatley's 74th-minute kick made the result safe, and Tovey missed a difficult penalty in the dying seconds for a chance to gain a late bonus point.
Rodney Ah You scored the only try of the match as Connacht won their opening match of the new RaboDirect PRO12 League campaign 11-9 in a low scoring match against Treviso in Italy.
Treviso, whose squad has been disrupted with several World Cup call-ups, started brightly and twice came close to scoring the opening try and took a deserved lead courtesy of a Willem de Waal penalty after eight minutes.
The South African fly-half then had the opportunity to double the hosts' advantage but missed what seemed an easy penalty.
The miss from de Waal seemed to galvanise Connacht who were level after 28 minutes when Matthew Jarvis scored a penalty of his own.
The visitors were in front at half-time thanks to Ah You's try with the New Zealander going over after some good work by lock Michael Stewart, although Jarvis missed the conversion to make the score 8-3 at the interval.
An attritional second half lacked clear-cut opportunities but Jarvis' second penalty after 56 minutes put Connacht further ahead and they held on to win the their first game of the new season.