With the clock already in the red at the Stade Aime Giral, Hanrahan produced a stunning sidestep 25 metres out and touched down out wide to hand the 2006 and 2008 champions a third win in four pool games.
Italian international Tommaso Benvenuti looked to have dealt Munster's hopes of a third Heineken Cup crown a heavy blow when he crossed with less than two minutes remaining but Rob Penney's men kept the ball alive from the restart, with Denis Hurley and Tommy O'Donnell setting up Hanrahan's heroics.
Munster began brightly and thought they had claimed the opening try with just six minutes on the clock when openside flanker Sean Dougal scampered over from 10 metres out.
The celebrations were shortlived, however, as referee JP Doyle called for assistance and the TMO ruled that James Downey was guilty of obstruction.
Instead, it was Perpignan who scored first just moments later through a well-struck penalty from former Scotland U20 fly-half Tommy Allen.
Both sides found themselves down to 14 men after 13 minutes when Munster skipper Peter O'Mahony and Perpignan hooker Romain Terrain were sinbinned for an off-the-ball altercation that led to a mass brawl.
Ian Keatley kicked Munster level after a quarter of an hour but Allen edged Perpignan back in front with his second three minutes later.
His third strike after 24 minutes pushed Perpigan six points clear and it stayed that until the break, although both kickers should have added to their tally.
Keatley failed from the tee after half an hour and Allen followed suit four minutes later, with Keatley missing again with the final play off the half.
Munster started the second half in a similar manner to the first, as Paul O'Connell and co repeatedly demolished the Perpignan scrum.
Doyle awarded three penalties and a free kick at a five-metre setpiece before finally losing patience and pointing to the posts for a penalty try. Keatley's simple conversion handed Munster the lead for the first time on 50 minutes.
Perpignan responded well and should have gone back in front before the hour. Allen was off target again before they turned down another kickable penalty in favour of a quick tap and the chance went begging when former England No8 Luke Narraway failed to hang on to a dreadful pass out wide.
Perpignan did regain the advantage when Allen struck his fourth penalty from wide on the left after 63 minutes but the lead was shortlived as Keatley made it 13-12 with 13 minutes left.
Benvenuti's try out wide should have been enough for Perpignan but Munster have proved time and time again that they can never be written off in Europe.
- Sports & Recreation
- Tommaso Benvenuti