A superb winning goal merely papered over the cracks of a far from convincing Rovers performance against a Dundalk side that deserved a point for their endeavours.
But goals win matches and Rovers winner was a joy to behold; Tony Grant the instigator with Sean Francis supplying the finish.
Starting well, a set-piece routine almost brought Rovers the lead after four minutes. Billy Woods and Derek Tracey worked the free-kick, but John Connolly made a superb save after Pat Scully's header took a deflection off Stephen McGuinness just yards in front of him.
Another fine move by Rovers had Dundalk stretched at the back again on nine minutes. Tommy Dunne's superb crossfield ball found Pascal Vaudequin in plenty of room inside the box. He took it first time on his right foot but sidefooted over the crossbar when he perhaps had time to kill it and pick his spot.
Their goal still intact, Dundalk settled and forced the play at the other end, winning four corners in as many minutes with James Keddy drilling a shot wide during that sustained period of pressure.
But a superb piece of football brought Rovers the matchwinning goal on 34 minutes with Grant's persistance and pace crucial.
Grant initially won the ball for Tracey before sprinting down the left to receive the pass. His cross was then perfection as Francis scarcely had to leave the ground to head home.
SHAMROCK ROVERS: O'Dowd; Costello, Scully, Palmer, Dunne; Vaudequin, Deans (Colwell 66 mins), Tracey, Woods; Francis, A Grant (S Grant 49 mins).
DUNDALK: Connolly; Hoey, McGuinness, Broughan, Crawley; Prizeman, Dunne, Kavanagh, Keddy (Connolly 72 mins); Ward (Ryan 79 mins), Reilly.
Referee: E. Barr (Dublin).