Five missed free throws in the last 17 seconds sent Hungary crashing to a 79-74 defeat at Bulgaria on Saturday evening.
In one of the most thrilling games in the additional qualifying tournament for EuroBasket 2007 so far, the Bulgarians, beaten in overtime at Bosnia-Herzegovina in midweek, were in danger of a second straight setback.
Istvan Nemeth's lay-up levelled the contest for Hungary at 74-74 with 17 seconds remaining and he was fouled on the play.
But the veteran center, who scored 18 points, missed the free throw, and Hungary fouled Hrisimir Dimitrov.
The 1.97m forward Dimitrov made both attempts to put his team back in front, but Bulgaria's Deyan Ivanov then fouled Balázs Simon, giving the 1.87m guard a chance to bring Hungary even again.
He was off target with both of his shots, however, on the second miss, Hungary's Roland Hendlein grabbed the offensive rebound and Bulgaria fouled him.
Hendlein also failed to convert either chance, though, and this time Ivanov rebounded as Bulgaria held on.
Hungary finished 16 of 25 (64%) from the line compared to 29 of 43 (67.4%) for Bulgaria.
Ivanov had 15 points to pace Bulgaria while Bader finished with a game-high 22 in defeat.
The Hungarians led 72-66 with 3:20 remaining after Martin Bader's lay-up.
But Bulgaria's American-born Roderick Blakney buried a three-pointer to close the gap to three.
After Yordan Bozov split a pair of free throws for Bulgaria, center Deyan Ivanov converted two chances from the stripe their next time down the floor to tie the contest at 72-72 with 1:11 to play.
Dimitar Angelov sent the home fans into raptures with a lay-up, only for Nemeth's lay-up to bring Hungary level.
That is when the free-throw shooting nightmare unfolded for Hungary.