Captain Chris Shields proved Peter Cherrie's saviour with a late equaliser to salvage a point for Dundalk in a roller-coaster game at Bishopsgate.
Their first goals from play in seven games was enough to lift Longford Town off the foot of the Premier Division table on goal difference after they availed of two goalkeeping howlers from Cherrie to run up a 2-0 advantage inside 14 minutes.
Sean Murray was way off target for Dundalk early on before the home side stunned their visitors by taking a sixth-minute lead.
Dylan Grimes worked a one-two with Dean Byrne just inside the Dundalk half to run on and hit a low shot which bounced twice in front of Cherrie whose feeble dive then completely missed the ball to see it end up in the bottom corner of his net.
And having waited over nine hours to score from play, a second goal duly arrived within eight minutes for Daire Doyle's midlanders, as they once again availed of a glaring goalkeeping mistake.
Karl Chambers' in-swinging cross from the left was inexplicably spilled by Cherrie. Striker Rob Manley pounced on the loose ball to shoot it to the net for his first goal of the season.
Though rattled, Dundalk passed the ball well and got a response on 20 minutes from their first corner of the game.
Michael Duffy whipped the delivery over to the far post where Dan Cleary nodded it down for Junior Ogedi-Uzokwe to tap in from close range.
Dominating the ball, Dundalk were close to levelling on 34 minutes; Sean Murray just failing to connect with a low cross from Raivis Jurkovskis.
But Longford continued to cause the Lilywhites issues when they got forward, Byrne skipping across their area to rifle a drive narrowly wide.
A minute later, the equally lively Grimes curled a free kick into the side netting.
In end to end action, another Dundalk corner should have seen them level a minute before the break.
Again Cleary got his head to Duffy’s ball into the area. This time, fellow defender Andy Boyle just couldn’t apply the finish at the back post.
A mistake by Boyle, who allowed Michael Kelly’s long kick out bounce past him, then let Manley in on goal two minutes after the restart.
Cherrie redeemed himself somewhat with a fine save one-on-one.
Despite once again enjoying plenty of the ball thereafter, Dundalk struggled to create clear-cut chances.
Minutes after coming on, substitute Wilfried Zahibo had the goal at his mercy only to fail to connect with Duffy’s free kick from the right.
But Jim Magilton’s side kept pressing and were rewarded nine minutes from time.
Junior slipped a pass through for the run of Shields who showed ample composure to find the bottom corner with a right foot drive.
Longford Town: Michael Kelly; Shane Elworthy, Mick McDonnell, Aaron O’Driscoll, Karl Chambers; Aodh Dervin, Dean Zambra (Joe Manley 77), Aaron Robinson; Dylan Grimes, Rob Manley, Dean Byrne.
Dundalk: Peter Cherrie; Raivis Jurkovski, Dan Cleary, Andy Boyle, Val Adedokun; Sean Murray (Daniel Kelly 75), Greg Sloggett (Wilfried Zahibi 62), Chris Shields; Patrick McEleney (Ole Midtskogen 62), Junior Ogedi-Uzokwe, Michael Duffy.
Referee: Damien MacGraith (Mayo).