Hungary breathed some life into their EuroBasket 2009 qualifying campaign by edging high-flying Bulgaria 87-86 in Group A on Saturday.
Marton Fodor, who had 17 points for Hungary, scored his biggest three right before the end with a shot from behind the arc for the final outcome.
Fodor was four of eight from three-point range and Hungary 13 of 28.
Bulgaria, who began with three straight wins, fell to 3-2 but are still in second place behind Serbia.
Hungary led 47-43 at half-time but then endured a nightmare start to the third quarter when Bulgaria reeled off 12 straight points for a 55-47 advantage.
Filip Videnov and Dimitar Angelov did all of the scoring for the Bulgarians in the run.
Hungary fought back to trail 72-70 at the end of the third quarter, only for Bulgaria to keep their noses in front for most of the fourth.
When Hungary's Marton Bader made one of two at the free throw line with 2:45 remaining, the game was tied at 84-84.
With 1:16 to play, Ivanov made a lay-up to put the Bulgarians back in front but Fodor's late three-ball clinched the victory in Salgotarjan for Hungary who are now 2-3.
Hungary guard Istvan Nemeth was outstanding on offense, making four of six from behind the arc on his way to a team-high 19 points.
Erno Sitku scored 13 and grabbed five rebounds.
For Bulgaria, Angelov had 21 points, Deyan Ivanov 16, Todor Stoykov 15 and Filip Videnov 12.