Hungary prevailed 72-62 in overtime at Croatia on Saturday to narrowly clinch a place in next year's EuroBasket Women.
In a thrilling final day, the Hungarians improved to 5-3 and edged out Ukraine in the race for the best third-place team in the four groups on a goal differential tie-breaker.
Croatia slumped to 2-6 with the defeat.
The last few minutes of the contest had the spectators on the edges of their seats.
Hungary's Zsofia Fegyverneky tied the game at 60-60 with 22 seconds left in regulation by making one of two free throws.
Croatia called timeout and when play resumed, the hosts had a chance to win at the end but Marta Cakic had her attempt from three-point range blocked by Hungary's Anna Vajda to force overtime.
Once in the extra period, Hungary's Orsolya Englert buried a three-pointer and Fegyverneky followed with a jumper to put the visitors on their way to a famous triumph.
They outscored the Croatians 12-2 in overtime.
Fegyverneky made three of five shots from long range and finished with 20 points to lead Hungary, who also got 17 from Nóra Bujdosó.
Hungary appeared to be in total command of at half-time when they led 45-26.
Croatia battled back and trailed 52-40 at the end of the third and then held Hungary scoreless for the first 5:41 of the final quarter.
Hungary, because of that drought, fell behind 53-52 after a basket from Luca Ivankovic and the lead changed handed six times before Fegyverneky tied the game with her free throw.
Ivankovic had 12 rebounds to go with her seven points for Croatia.