The Blues pulled ahead after the restart - Monoa Vosawai running over and Gareth Davies converting.
Hanrahan pulled his side level and, despite Davies restoring the Welsh side's lead, a late try from Paddy Butler was enough for Munster to seal the win.
And, while Hammett was pleased with his side's overall performance, he admitted discipline was the difference between winning and losing.
"From a coaching perspective, when you take the result out and look solely at the action in the game, that is the best we played this season," he said.
"We played well for long periods, the structure was good, our intensity was good and our ball carrying was good. What let us down was individual skill sets, passing and missing touch.
"From a collective, it is hard to ask more from the group, Munster played until the end and had chances to shoot a goal and backed their line out, so credit to them.
"But our mistakes put them in good positions.
"The first half, we were trailing 18-14 and it was penalties that cost us. On halfway we were going too hard with side entry and not rolling away.
"They very rarely got into our half in the first 40 minutes, but they kept ticking over the points. If you look at the reason we lost it would be indiscipline, certainly in the first half."
Click here for the best images from Munster's win over Cardiff
Follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the GUINNESS PRO12