Prestatyn Town booked their place in the Europa League second qualifying round with a thrilling penalty shoot-out win at Liepajas Metalurgs.
Leading 2-1 from the first leg in Wales, Metalurgs looked to be cruising when Valerijs Afanasjevs struck early.
But the Latvians had Dzintars Zirnis sent off and Ross Stephens started Prestatyn's fight-back, before Neil Gibson grabbed a 90th-minute goal.
Extra time was scoreless and Prestatyn emerged winners 4-3 on penalties.
Jurgis Kalns missed the opening spot-kick for Metalurgs and Gibson took advantage to stroke home and give Prestatyn an advantage they never squandered.
Stephens, Sean Hessey and Michael Parker all found the back of the net for the Welsh Premier League side before Davis Ikaunieks missed a second penalty for the home side, handing Prestatyn victory.
Prestatyn now face HNK Rijeka in the second qualifying round and the Welshmen travel to Croatia for the first leg on Thursday, 18 July.
Prestatyn Town head coach Chris Hughes:
"It's an unbelievable feeling, it won't sink in at the moment - most of the lads are just looking at each other now and the managing staff are asking, 'what have we done?'.
"The game typified us. We were 1-0 down with 25 minutes to go and they went down to 10 men.
"We knew we had to score and it didn't really matter if they scored - we knew we had to get two goals to have a chance of getting back into the tie.
"We scored a really good first goal and then the second was a great little finish by Neil from a good pull-back from Andy Parkinson."
Sorry, we were unable to load match stats, please try again.