Munster scored three converted tries in the final 10 minutes to break clear of London Irish and earn a confidence-boosting bonus point win.
Irish were just 12 minutes away from becoming only the second team to beat Munster in a Heineken Cup tie at Thomond Park.
Their captain Seilala Mapusua scored a try and set up the second for Sailosi Tagicakibau as the visitors edged into a 14-7 lead, after a scoreless first half.
But Munster, who are Amlin Challenge Cup-bound now, hit back decisively with late tries from Niall Ronan, Keith Earls and replacement Darragh Hurley.
That closing barrage of points put a gloss on the final scoreline, but Munster can take heart from how they raised their game when staring at a possible third pool defeat.
Smarting from their Toulon nightmare, Munster made a sprightly start in heavy underfoot conditions, getting Johne Murphy and Denis Hurley involved early on.
Mapusua, in his final Heineken Cup outing for Irish, announced himself with a typical midfield burst, and Munster were unable to convert their early territory into points.
A solid lineout platform and some clever kicking from Darren Allinson brought the visitors forward, but they were hampered by prop Faan Rautenbach's sin-binning for stamping on David Wallace at a ruck.
Dan Bowden was short with a 45-metre penalty attempt, after John Hayes was penalised in the scrum, and the New Zealander also flicked a drop-goal attempt wide of the uprights.
There was plenty of endeavour from both sides, but handling errors made for a scrappy second quarter. Munster ended the half on the attack after using their lineout to good effect from a penalty.
From a well-orchestrated maul three minutes before the break, the Munster forwards pressed and Damien Varley was held up over the try-line by a combination of Mapusua and Elvis Seveali'i.
Hooker Varley was thwarted again in the final minute - television match official Derek Bevan making the decision this time - and although Keith Earls got over in the corner in injury-time, Lifeimi Mafi's scoring pass was ruled forward.
On the resumption, Tomas O'Leary drove Munster forward with a lovely break in midfield. A subsequent penalty was dispatched to touch, and Varley plunged over for his deserved try after another forceful maul.
O'Gara nailed the conversion from the right of the posts, before Irish responded through their forwards. Their efforts went unrewarded however, Chris Hala'ufia's break from a five-metre scrum ruined by an accidental offside.
Then the game burst into life. Mapusua reacted quickest after O'Leary's clearance kick was charged down by Jamie Gibson and the Samoan touched down in the left corner.
Bowden followed up with the conversion to make it 7-7, right on the hour mark, and Irish, who ended their 10-match losing run against the Ospreys last Sunday, were suddenly forcing the issue.
In the 67th minute, Mapusua did brilliantly to dink a kick ahead, gather the ball at pace and link with Topsy Ojo whose pass out of the tackle teed up Tagicakibau for an easy run-in past O'Gara.
Replacement Ryan Lamb added the difficult conversion, and a famous victory was tantalisingly close for Toby Booth's men. Munster had other ideas, and they were helped on their way by a yellow card for Gibson.
Immediately, Munster hit back with their second try. Replacement Tony Buckley was held up short, before flanker Ronan picked from the ruck and dived over with O'Gara converting.
Three minutes later, they had another. Paul O'Connell stole a lineout and rampaged through the middle, moments later, and O'Gara's superbly-weighted kick to the corner was gleefully finished off by Earls.
O'Gara swung over the conversion and did likewise in injury-time after prop Hurley had muscled past Paulica Ion and Paul Hodgson, just metres from the line.