An injury-time goal from Barry Hogan gave The New Saints their first-ever European win in the Champions League. Mike Wilde gave the Saints the lead at Newtown's Latham Park in the first qualifying round tie with a diving header, before Vits Rimkus equalised.
Phil Baker restored the advantage in the second half, but striker Rimkus got his second in the 89th minute.
Hogan dramatically fired in from 10 yards deep into injury time to give the Saints hope for the 25 July second leg.
The overall winners advance to face Austrians FC Salzburg in the second qualifying round.