Sean Gannon was the hero for Dundalk who come away from Tallaght Stadium with a massive three points to send them eight clear at the top of the Premier Division.
Gannon's goal on the 72nd minute came completely against the run of the game with substitute Jamie McGrath slipping Gannon through and the right-back found the net, with the help of the post.
It was a game controlled for the most part by the home side and Stephen Bradley will be coming away a frustrated man, not least because of some controversial decisions from the referee.
The moment of the match came when Gary Rogers fouled Trevor Clarke in the 60th minute just outside the box and escaped with just a booking.
The left-back had nipped in between the Dundalk defence and beat Rogers in a one-v-one race to the ball. The goalkeeper clipped Clarke, but the referee opted to show his yellow rather than red card on this occasion.
Shamrock Rovers started without their two top scorers in Aaron Greene and injured Aaron McEneff, however, it was the home side that threatened early on.
Jack Byrne looked full of energy and dangerous in the opening quarter - providing the crowd with the first shot on goal after four minutes, a nice shot on the turn inside the box just missing the target.
He continued to battle with Chris Shields for control of the midfield throughout the first half.
The game was a feisty encounter from early on, Trevor Clarke laid down an early marker on John Mountney after 12 minutes - he returned the favour to Sean Kavanagh a few minutes later, both were booked for their efforts.
Rovers were well on top for the majority of the first half, Byrne the main illustrator in sustained pressure and finding himself in pockets of space within the middle of the Dundalk defence, the final ball letting the youngster down.
The home side upped the ante in the closing 10 minutes of the opening 45 and could have gone ahead three times in the space of three minutes.
The first came when Carr was played through on the left wing and slipped it through to Ronan Finn at the back post, it took a sensational block from Dane Massey to keep it out; Joey O'Brien came close with a header from the resulting corner.
Two minutes later, Jack Byrne was denied a potential goal of the season when his shot from 25-yards out smacked the crossbar, had it been an inch lower, Gary Rogers had no chance.
The closest Dundalk would come to an effort on goal was a snapshot from right-back Sean Gannon which sailed well over the bar.
They did have a potential, albeit unlikely, penalty shout in the final minute of the half. Gannon's cross looked as though it hit off the arm of Kavanagh, but the referee wasn't entertaining shouts.
Dundalk played with much more purpose after the break and threatened the Rovers goal early on, Patrick Hoban was unlucky to have a shot from inside the box blocked by Lee Grace.
Rovers had just started to turn the screw again when Trevor Clarke picked up on a loose pass and rushed through the heart of the Rovers defence and was fouled by Rogers.
The decisive goal came on the 72nd minute down the right-hand side when Jamie McGrath showed great composure to find the on running Gannon inside the box and the right back finished well passed Alan Mannus.
Aaron Greene had a couple of half-chances in a manic final ten minutes, but couldn't find an equaliser for Bradley's men.
Another Dublin derby awaits Shamrock Rovers as they face St Patrick's Athletic on Monday night, while Dundalk host Waterford at Oriel Park.
SHAMROCK ROVERS: Alan Mannus, Trevor Clarke, Roberto Lopes, Lee Grace, Greg Bolger, Joey O'Brien, Dylan Watts, Ronan Finn, Dan Carr, Jack Byrne, Sean Kavanagh
DUNDALK: Gary Rogers, Sean Gannon, Brian Gartland, Sean Hoare, Chris Shields, Michael Duffy, John Mountney, Patrick Hoban, Patrick McEleney, Dane Massey, Sean Murray.