Two goals from Andrejs Rubins helped Latvia come from behind to finish their World Cup qualifying campaign with a 3-2 home win over 10-man Moldova to secure third place in Group Two.
Latvia had only the remotest chance of snatching a place in the finals - and despite their victory, results elsewhere ensured they will not be going to South Africa next summer.
Moldova remained bottom after their seventh defeat of a winless campaign.
Heavy rain and wind did not prevent an entertaining match in front of a crowd of a 3,800 crowd at Skonto Stadium.
Moldova began well, and midway through the first half the Latvians found themselves behind.
Pacy Gheorghi Ovseannicov beat Andris Vanins with a volley, converting Valerii Catinsus' precise cross from the right.
But the visitors were left with 10 men five minutes later, after captain Serghei Lascencov received a straight red card for handling a promising through-ball by Latvia captain Vitalijs Astafjevs, who was equalling Martin Reim's all-time European record 157 international caps.
Two minutes later, his team were level.
Andrejs Rubins found the bottom corner from a free-kick - and a minute before the break, the same man put Latvia ahead with another low shot after good work by Maris Verpakovskis.
Substitute Kristaps Grebis needed only eight minutes to increase the lead as he finished from close range after a cross by another substitute, Gendijs Soloicins.
Moldova managed to reduce the deficit just before the final whistle.
Substitute Veaceslav Sofroni decided to try his luck from distance and got it right with a fierce shot, deflected in off Kaspars Gorkss.
Teams
Latvia Vanins, Klava, Astafjevs, Gorkss, Kolesnicenko (Laizans 74), Ivanovs, Kacanovs, Cauna, Verpakovskis, Rubins (Solonicins 63), Karlsons (Grebis 68).
Subs Not Used: Kolinko, Zirnis, Pereplotkins, Mihadjuks.
Booked: Karlsons, Rubins.
Goals: Rubins 32, 44, Grebis 76.
Moldova Stanislav Namasco, Catinsus, Golovatenco, Lascenov, Armas (Andronic 81), Epureanu, Savinov, Sergiu Namasco, Calincov, Bugaev (Suvorov 70), Ovseanicov (Sofroni 76).
Subs Not Used: Matiughin, Bulat, Cebotari.
Sent Off: Lascenov (30).
Booked: Golovatenco.
Goals: Ovseanicov 25, Sofroni 90.
Att: 3,800
Ref: Jouni Hyytia (Finland).