An 18-17 success puts the two-time Heineken Cup champions' in firm control of Pool 6, but w hen Tommaso Benvenuti ran in the try for Perpignan that put them ahead in the 77th minute, the game looked dead for Munster.
Yet they conjured something out of nothing and Hanrahan's try from the last move of the match made it 18-17 to the visitors at the Stade Aime Giral.
"We knew how hard it was going to be coming away to France. Any game over here is tough, especially in a cauldron like this," said O'Mahony.
"We knew it would take something special to get a win and as happened it was a special performance from a team that wasn't playing particularly well.
"But the sign of a good team and a team that is progressing is to get a win like that out in France. It is certainly going to be up there in many books.
"We wanted to win more than anything. We expected a fight and we got it all right - it was bruising and there will be plenty of sore bodies tomorrow.
"We spoke about that and we said it would pay off. We said that if we went to a dark place, and we hurt ourselves, we were going to be in a good place. And that's where we are - we are in a good place.
"We have two to go but this has put us in a good position. We will enjoy this over Christmas."
Munster must still play Gloucester and Edinburgh in January, but they end the year where they wanted to be.
O'Mahony offered particular praise to the Munster pack, whose pressure told with a penalty try early in the second half.
"We have some great game-breakers and with a team like this you can never give up," O'Mahony said.
"We trusted our scrum. We know it is good. We had to show some bottle there and credit to the front row, the front five and the whole pack for that penalty try."
- Sports & Recreation