Donncha O'Callaghan's converted try restored Munster's lead but a Chris Paterson penalty restored parity before Ronan O'Gara stepped up to kick the winning points.
Leamy admitted Munster should have converted their supremacy into more points, but praised their determination to grind out a win in a hostile environment.
"We were really disappointed to be ahead just 6-3 at half time," said Leamy.
"Although we had all the first-half pressure, we never really threatened and we had to show a lot of character when we went behind.
"Murrayfield has not been a good ground for us in recent years, so we are delighted to have got the win.
"When we play the Ospreys next week we have to convert pressure into points and improve aspects of our scrummaging as well as one or two points in the line-out."