Dundalk will head to Azerbaijan next week full of hope that they can advance to the third qualifying round of the Champions League after Patrick Hoban's header secured a 1-1 draw at home to Qarabag.
After a disastrous start which saw them concede an away goal after just four minutes, the League of Ireland champions found themselves on the back foot for long periods in the first half but they hung in there and took the game to their illustrious opponents in the second.
Hoban's header, which almost lifted Oriel Park off the ground, came at a stage when the Lilywhites were pressing hard and Vinny Perth's side even had chances to win it in the dying stages with both Michael Duffy and Dane Massey going close to snatching a famous victory.
There were no real surprises in Perth's starting line-up. Duffy, who missed the game in Riga due to the birth of his son Eli, returned to the left flank with Jamie McGrath given the nod ahead of John Mountney on the right. Gary Rogers made his 42nd European appearance, creating a new record for a League of Ireland player.
His counterpart, Gurban Gurbanov, didn't have it quite as straightforward, although his team still contained seven players capped by their country. Croatian midfielder Filip Ozobic was only fit for a place on the bench while creative Spaniard Michel was also listed amongst the substitutes. They were replaced by Bulgarian and Azerbaijani internationals Simeon Slavchev and Gara Garayev respectively. Alongside them was the craft of Richard Almeida, born in Brazil but now an Azeri international.
The Dundalk head coach spoke about concentration in the build-up to the game so heaven knows what he was thinking when Sean Hoare, the hero in the penalty shootout win over Riga in the first round, conceded a needless corner that led to the opener with less than five minutes on the clock.
Hustled by black shirts just inside his own half, the centre-half's attempted pass back to Rogers carried too much weight and little direction and from Jaime Romero's corner, Mahir Emreli got up above Massey to see his header beat Rogers with the aid of a deflection off Hoban. It was a criminal away goal to concede.
If that was bad, worse almost followed tww minutes later. Chris Shields coughed up possession and Qarabag broke with intent on the left with Emreli's chip finding the incoming Slavchev, who could only head wide.
It took a while for the home support to clear the cobwebs but they were given encouragement when Sean Gannon whipped in a cross from the right that Vagner eventually gathered after a couple of hops.
Gurbanov's side, however, dictated matters with Almeida, pulling the strings in the centre of the park. His positioning allowed Ailton to spring forward at every opportunity and the full-back, in tandem with winger Abdellah Zoubir, wreaked havoc.
The Frenchman was desperately unlucky not to score a wonderful second just past the half hour. Running at pace, a devilish cut-back with his right foot killed Gannon and Andy Boyle but he could only drag the subsequent effort wide of the post.
Rogers then came to his side's rescue with a fine stop to deny Slavchev five minutes before the break and he did likewise suit shortly after, denying Zoubir after another bout of quick feet by the Qarabag no 17 left Chris Shields trailing.
Dundalk, who were dealt a blow when Robbie Benson limped off with less than half an hour played with a rib injury, looked heavily reliant on breaks but there were fleeting moments that suggested they could really hurt their opponents in the first half.
Duffy, who was relatively quiet, showed that he was capable of beating Maksim Medvedev and Gannon offered an outlet whenever possible but too many in white struggled to impose themselves on the game.
Up top, Hoban worked harder than anyone but was kept on a leash by 37-year-old Rashad Sadygov. With over 100 caps and 90 European games to his name, the Qarabag skipper showed all of his experience.
The half-time break offered Perth and his staff an opportunity to right a few wrongs and Dundalk started the second half in impressive fashion with Patrick McEleney firing over under pressure from Garayev before Sean Murray, Benson's replacement, had a drive blocked by Slavchev.
That promise almost counted for nothing as Qarabag went close to bagging another away goal in the 57th minute. Boyle was dispossessed by Emreli as he broke from the back but Romero could only fire over after an inviting set-up by Zoubir. Rogers was then thankful to see an Almeida effort clear the bar after he could only parry a Romero shot from distance.
With Shields becoming more influential, Dundalk wrested control and got their reward with 12 minutes to play. Jamie McGrath looked odds on to equalise when he hopped up after a challenge with Rahil Mammadov to shoot but the defender did just enough to divert the shot behind.
It looked like that would be Dundalk's best chance of the night but when Murray's corner bounced off the chest of Slavchev, Hoban pounced, heading home to send Oriel Park crazy.
With the home crowd urging them on, Dundalk went for it and they almost found a winner when Gannon cut the ball back for McGrath, but Vagner was equal to his effort.
Massey went even closer, fizzing an effort over the bar in stoppage time and the sides will do battle at the Dalga Arena in seven days time with it all to play for.
DUNDALK FC: Gary Rogers; Sean Gannon, Sean Hoare, Andy Boyle, Dane Massey; Chris Shields, Robbie Benson (Sean Murray 27); Jamie McGrath, Patrick McEleney. (John Mountney 69), Michael Duffyl Patrick Hoban (Georgie Kelly 83).
QARABAG: Vagner; Maksim Medvedev (Abbas Huseynov 53), Rashad Sadygov, Rahil Mammadov, Ailton; Simeon Slavchev, Gara Garayev; Jaime Romero (Araz Abdullayev 87), Richard Almeida, Abdellah Zoubir; Mahir Emreli.
REFEREE: Bartosz Frankowski (Poland)