Portadown conceded an early goal but fought back to beat Macedonian side Shkendija in the Europa League first qualifying round at Shamrock Park.
The Ports had drawn 0-0 away but fell behind in Tuesday's return when Ardian Cuculi fired in from eight yards.
Richard Lecky headed the Ports level and Ross Redman scored an 80th-minute winner from a 50-yard free-kick after a bad mistake by keeper Hadis Velii.
Ronnie McFall's man now face Croatian team Slaven Belupo Koprivnica.
The Ports will be away for the first leg of the second qualifying round on Thursday, 19 July.
Even if they managed to win that, the Irish League side would still have to clear two hurdles to reach the group stage as there is a third qualifying round, followed by a play-off round.
Two years ago, League of Ireland side Shamrock Rovers reached the group stage, but no Irish League club has ever achieved it.
It was Portadown's first home victory in Europe since defeating Icelandic side Valour in 1974 when Ports manager McFall scored the winner.
It took FK Shkendija just three minutes to score the opening goal and shock the home support, Cuculi firing in after Portadown failed to properly clear a Nebi Mustafi corner.
The visitors almost doubled their advantage in the 13th minute but Portadown goalkeeper David Miskelly positioned himself well to palm away Muzafer Ejupi's low shot.
Kevin Braniff should have equalised nine minutes before half-time but couldn't direct his header goalbound after a surging run and pin-point cross from Sean Mackle.
Ten minutes before half-time, Darren Murray was inches away from scoring for the home side with a low driving shot after some superb work in the build-up from summer signing Joe McNeill.
Lecky equalised for Portadown on the 57 minutes, heading in from a Murray cross to give the home side hope.
The Reds squandered a series of chances before they grabbed the winner with Lecky and Darren Murray both failing to find the net with the home side dictating the play.
However, with just 10 minutes remaining Redman caught out visiting keeper Hadis Velii with the long-range free-kick.
Miskelly, Redman, Breen, Casement, Gartland, Mackle, McNeill, McCafferty, Murray, Braniff, Lecky.
Shortt, O'Hara, Acheson, Burns, Brown.
Velii, Cuculi, Miskovski, Berisha, Mustafi, Neziri, Selmani, Demiri, Tahipi, Aliji, Ejupi.
Nikov, Alievski, Elmazovski, Redzepi, Emini, Besar, Hasan.