Ronan O'Gara displayed nerves of steel to land a last-minute penalty and seal Munster's first win over fierce rivals Leinster in six attempts.

Man-of-the-match O'Gara kicked seven penalties from eight attempts in a fascinating duel with his Ireland colleague Jonathan Sexton, who finished with six penalties to his name. But the victory was soured by a worrying ankle injury for Munster captain Paul O'Connell.

Tony McGahan's men are 12 points clear of the chasing pack at the top of the table with three rounds remaining.

Shane Horgan crowned his 200th appearance for Leinster with the only try of a furiously competitive first half. Horgan's 21st-minute score was supplemented by five well-struck penalties from Sexton, giving Leinster a healthy 20–9 half-time lead.

But Munster produced a sizzling second-half display as their tireless forwards took the game to the visitors to allow the fly-half to boot them to victory.

O'Connell, such a crucial presence lately for both province and country, forced a penalty at an early breakdown as Leinster looked to build momentum. Munster mauled forward off the resulting lineout and O'Gara converted a close-range penalty for a fifth minute lead. Sexton replied two minutes later, after Donnacha Ryan was punished for a ruck infringement.

Munster were first to get within try-scoring range, the outstanding David Wallace driving toward the line off a five-metre lineout. A solid scrum from the hosts set up a penalty from which O'Gara restored their lead at 6-3.

Sexton increased his influence by striking two left-sided penalties through the posts, nudging Leinster ahead by the midpoint of the half. And just moments later, Horgan delighted the travelling support by finishing off a training ground move in the right corner. Isaac Boss and Gordon D'Arcy combined off a scrum on the halfway line and sent Isa Nacewa through a gap, with the full-back's well-weighted kick gobbled up by the onrushing Horgan.

Munster lost Johne Murphy to the sin-bin for holding on after making a tackle, and Leinster, who carried the bigger threat in broken play, pressed on. Sexton coolly slotted the resulting penalty from a difficult position on the right and, after a timely turnover from Boss, a good kick and chase from Jamie Heaslip set up a chance for the Leinster fly-half to move the lead out to 11 points.

But 14-man Munster immediately lifted the tempo at the start of the second half, O'Gara sustaining a facial wound as he chased his own chip. Paul Warwick, O'Gara's blood replacement, knocked over a penalty and the returning No10 added another to increase the pressure on Leinster.

The loss of captain O'Connell, who fell awkwardly at a lineout, did not deter Munster and O'Gara whittled the gap down to 20-18, when Mike Ross was singled out for a scrum infringement.

Munster had the bit between their teeth and Leinster were falling foul of referee Andrew Small's whistle. Brian O'Driscoll was the second player to see yellow, when he was picked out for a similar breakdown offence to Murphy's.

O'Gara edged his side ahead with another fine strike, from just inside Leinster's half, but the red tide was halted by Sexton's 66th-minute penalty after some good work from Nacewa.

At 23-21 down, O'Gara pushed a penalty wide to the right after a Munster maul was dragged down illegally, but there was no sense of panic from the hosts. They were making good use of possession and some fresh legs in the pack kept them going forward.

In a frantic finale, Leinster coughed up a penalty five metres from the try line. It was a tough kick from wide out on the left, but O'Gara showed his class once again to snatch the win.