Derry City went close to coming away from Oriel Park with all three points on Friday had they not conceded three minutes from time to Chris Shields.
The Candystripes hit the woodwork on three occasions before David McDaid finally put them in front when he guided the ball home from close range after 74 minutes.
Dundalk had a good shout for a goal ruled out when Robert Waters’ header looked to have crossed the line shortly after but they did force an equaliser when Shields beat Ger Doherty with three minutes to go.
Caretaker manager Darius Kierans was forced to make one change from the side which drew 1-1 with Shamrock Rovers in their previous outing with Waters coming in to replace the injured Liam Burns.
Derry City boss Declan Devine had to plan without the services of injured trio Stewart Greacen, Kevin Deery and Rory Patterson. Ruaidhri Higgins missed out through suspension but the Candystripes welcomed back Stephen McLaughlin and Simon Madden, the latter played every minute for Dundalk last season.
Dundalk goalkeeper Peter Cherrie was making his 100th appearance for the Lilywhites and to mark the occasion the Scot was named as his side’s skipper for the night.
City arrived needing a win to keep their hopes of a European place alive and Cherrie was called into action as early as the first minute when David McDaid flashed a volley at goal from a difficult angle on the right.
At the other end Marc Griffin had a chance to punish Ger Doherty after a mix up in the Derry City defence but the striker – who has been linked with a move to the Brandywell in recent weeks – hurried his shot and the chance was lost.
A nondescript 44 minutes followed with both sides wasteful in possession. Dundalk again looked short in quality when in possession but without the ball they remained disciplined and frustrated Derry although the Candystripes should have taken a lead into the half-time break.
Declan Devine’s side squandered a glorious opportunity just shy of the half hour mark. Stephen McLaughlin was the architect, leaving Dundalk full-back Ben McLaughlin - a grandson of former Lilywhites and Candystripes manager Jim - floundering in his wake on the left flank.
The Candystripes winger made his way into the Dundalk box where his cutback found David McDaid but the striker scuffed his effort and the ball bounced back off the crossbar from six-yards when it seemed harder to miss.
The home side were let off the hook again in the 40th minute when Ryan McBride headed over the bar after a Dermot McCaffrey corner had taken Cherrie out of the equation and a lacklustre first-half came to an end with the sides level.
If the first-half was a non-event, the same could not be said of the second.
McLaughlin continued to pose a threat to the Dundalk back four and in the 55th minute he went close to breaking the deadlock. The Derry number 15 cut inside to stab a deflected left footed effort towards goal only to see it bounce off the underside of the crossbar and away to safety.
Four minutes later McLaughlin hit the woodwork again. This time McDaid was the creator, lofting a ball to the far post where McLaughlin did well to acrobatically guide an effort on target; Cherrie was beaten but not the upright.
That seemed to wake Dundalk from their slumber and in the 62nd minute the Oriel Park faithful were brought to life when Derry City goalkeeper Ger Doherty did well to push a Robert Waters effort over the top.
Controversy followed from Nathan Murphy’s resulting corner. Waters looked to have forced a header home but Doherty palmed the ball clear with Dundalk players protesting that the ball had clearly crossed the line. Referee Paul McLaughlin waved away their protests.
With the game becoming more open, the deadlock was finally broken 11 minutes later. Derry City left-back Dermot McCaffrey broke on the left and his cross was knocked home from close range by David McDaid to give the Candystripes a deserved lead. That looked enough to have secured the visitors three points but Dundalk staged a late rally.
Shields went within inches of restoring parity when he smashed a half volley just off the mark in the 83rd minute but he was not to be denied and two minutes later the Dundalk club captain rose to head home from six-yards following a flurry of Dundalk corners.
There was still time for a late twist and the hosts almost staged a smash and grab when substitute Michael Rafter found himself with space to shoot bit his left footed drive failed to trouble Doherty.
DUNDALK: Peter Cherrie, Ben McLaughlin, Derek Foran, Chris Shields, Nathan Murphy; Paul Walsh, John Mountney, Stephen McDonnell (Peter Thomas 80), Robert Waters (Michael Rafter 67), Gary Shanahan; Marc Griffin.
DERRY CITY: Gerard Doherty; Simon Madden, Shane McEleney, Ryan McBride, Dermot McCaffrey; Owen Morrison (Mark Farren 82), Patrick McEleney, Barry Molloy, Stephen McLaughlin; Conor Murphy, David McDaid
REFEREE: Paul McLaughlin (Monaghan).
ATTENDANCE: 750 approx.