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."
- 01 Varazinskis
- 04 Zirnis Dismissed after an earlier booking
- 25 Slampe
- 28 Anton Jemelins Booked
- 07 Ikaunieks (Zuntners - 65' )
- 16 Hmizs (Slampe - 46' )
- 18 Sadcins
- 19 Afanasjevs (Kirilins - 96' Booked )
- 08 Kalns
- 09 Ikaunieks Booked
- 17 Prohorenkovs
- 31 Viksna
- 02 Mikelsons
- 10 Zuntners
- 05 Otankis
- 13 Petruks
- 14 Slampe
- 87 Kirilins
- 01 Roberts
- 03 Lewis
- 04 Hayes
- 05 Hessey Booked
- 23 Stones
- 02 Davies (Murray - 113' )
- 07 Parker
- 08 Gibson Booked
- 09 Parkinson Booked
- 24 Holmes (Owen - 75' Booked )
- 11 Stephens
- 25 Hill-Dunt
- 12 France
- 16 Kemp
- 22 Markland
- 17 Murray
- 20 Owen