Will Patching was the hero as his 92nd minute strike saw Dundalk get the better of Levadia Tallinn in the A Le Coq Arena to set up a Europa Conference League third qualifying round tie against Dutch side Vitesse next week.
The midfielder latched onto a Patrick McEleney pass in stoppage time to score his third European goal of the campaign since returning from a loan spell at Derry City and seal a 4-3 aggregate victory.
Having trailed twice in the first leg which finished 2-2, Vinny Perth's side had to do things the hard way once again having fallen behind on 17 minutes to a strike from Patching’s former Manchester City team-mate Ernest Agyiri.
However, a 14th European goal from David McMillan on the stroke of half-time brought them level before Patching popped up with a winner that ensures a pay day of at least €850,000 regardless of the outcome against Vitesse.
The visitors were on top right from the off but a long range strike from Sam Stanton which sailed over on four minutes was all they had to show for their efforts before Levadia took the lead with their first shot in the 17th minute.
Stanton was at fault on this occasion as he gifted possession away cheaply to Frank Livvak with Zakaria Beglarishvili setting Agyiri down the left.
The Ghanaian winger then rippled the net with an early shot from the corner of the penalty area which flashed through the arms of Alessio Abibi.
Dundalk continued to boss possession after that without creating much of note.
They were unlucky not to equalise in the 29th minute, however, when Stanton broke from midfield before letting a left foot shot fly that spun off the top of the crossbar and over.
Patching had a free kick into the wall after that before McEleney was denied by Karl Andre Vallner but the Louth men would conjure up a deserving equaliser a minute before the break.
Vallner failed to deal with Darragh Leahy’s cross from the left with Raivis Jurkovskis keeping it alive by heading to Greg Sloggett inside the box.
The former UCD player then crossed to McMillan, who held off Mitrovic before firing to the bottom left hand corner to make it 1-1.
Vladimir Vassiljev and Marko Savic’s side, who had only had the Agyiri goal as an effort up until then, did manage a couple of attempts in stoppage time at the end of the half but the first from Agyiri was blocked by Jurkovskis before substitute Mark Oliver Roosnupp, who had replaced Levadia’s injured first leg double goalscorer Bogdan Vaštšuk, fired well wide.
Dundalk then almost hit the front within six minutes of the restart when a mistake by Maximiliano Uggè gifted Stanton the chance to get a shot away inside the penalty area but his effort flashed agonisingly across the face of goal.
Levadia grew into the game after that and felt they should have had a penalty on 55 minutes when Beglarishvili’s cross struck the arm of Andy Boyle as he slid in to block.
Referee Thorvaldur Árnason waved away their appeals and admittedly it would have been a harsh decision against the Lilywhites skipper.
Sloggett then found space to get a shot away on the hour mark but his effort from 25 yards was straight at Vallner.
The Levadia goalkeeper then had a major let-off two minutes later when he spilled Sonni Nattestad’s header from Patching’s corner only to juggle the ball away before Leahy could pounce on the rebound. Agyiri then had a good chance on 67 minutes when the ball broke to him from Roosnupp at the edge of the box but his effort was tame and straight at Abibi.
McEleney then curled an effort agonisingly wide with quarter of an hour to go before Stanton had another good effort blocked by Mitrovic on 88 minutes.
Dundalk were not to be denied however and in the second minute of additional time McEleney picked out the run of Patching who controlled superbly before rifling a shot past Vallner.
The Lilywhites had to survive some late Levadia pressure after that but held out for a famous away win which ensures a trip to the Netherlands next Thursday.
Levadia Tallinn: Karl Andre Vallner; Maksim Podholjuzin, Maximiliano Uggè, Milan Mitrovic, Milijan Ilic (Trevor Elhi 70); Brent Lepistu; Frank Liivak, Marko Putincanin, Bogdan Vaštšuk (Mark Oliver Roosnupp 34), Ernest Agyiri (Karl Rudolf Õigus 71); Zakaria Beglarishvili (Robert Kirss 65).
Subs not used: Artur Kotenko, Rasmus Peetson, Luka Lukovic, Markus Jürgenson, Amar Yunis Abdallah, Hannes Anier.
Dundalk: Alessio Abibi; Raivis Jurkovskis; Andy Boyle, Sonni Nattestad, Darragh Leahy; Sam Stanton (Wilfried Zahibo 91), Greg Sloggett; Daniel Kelly (Sean Murray 70), Will Patching, Patrick McEleney; David McMillan (Patrick Hoban 62).
Subs not used: Peter Cherrie, Niall Brady, Cammy Dummigan, Val Adedokun, Ryan O’Kane, Mark Hanratty, Han Jeong-woo.
Referee: Thorvaldur Árnason (Iceland).