Linfield won their Uefa Cup first qualifying round tie against Ventspils on away goals after this second leg defeat left the aggregate score 2-2.
Peter Thompson scored Linfield's vital away goal in Latvia
Striker Peter Thompson gave the Irish Premier League side an eighth minute lead, bundling home from close range.
Captain Aleksander Rehviashvili headed past Alan Mannus for the equaliser on 39 minutes but the Linfield goalkeeper went on to make several crucial saves.
Substitute Vitas Rimkus grabbed a late consolation with an injury-time strike.
Thompson bundled home the vital away goal after Glenn Ferguson's shot was blocked by goalkeeper Pavel Davidov.
Rehviashvili's equaliser saw him connect with a delicate chip cross from Jiri Krohmer.
The Latvians, needing to score two more goals to win the tie, continued to press and Jim Ervin cleared off the line while Aleksander Gruber headed over.
Tim Mouncey went close for the visitors a minute before the interval when he headed over from Aidan O'Kane's free-kick.
Ventspils introduced three fresh strikers at the start of the second half but the Linfield defence held firm.
David Jeffrey's side had their chances with Ferguson heading wide from O'Kane's corner and then his goalbound shot was tipped over by Davidov.
Mannus made fine saves to deny Georgi Modebadze and Andreas Butriks in the 88th and 89th minutes before Rimkus' goal two minutes into added time.
The striker sidefooted home from six yards out following a period of sustained pressure by the home side.
FK Ventspils: Davidov, Kacanovs, Lukasevics, Soleicuks, Zavoronkovs, Stukalinas, Bicka, Gruber, Krohmer, Rehviashvili, Slesarcuks.
Subs: Romanovs, Logins, Kuvsinovs, Toryan, Rimkus, Butriks, Modebadze.
Linfield: Mannus, Ervin, McShane, Kearney, Murphy, O'Kane, Thompson, Mouncey, Ferguson, Gault, Bailie.
Subs: McKnight, Douglas, Gargan, Picking, McAreavey, Kingsberry, Larmour.
Referee: Hristo Ristoskov (Bulgaria)