Playing at the Conygar Bridge Meadow Stadium in Haverfordwest, Flynn's side of relative unknowns had fallen behind before drawing level, only to be beaten at the last.
Kaposvari Rakoczi FC midfielder Benjamin Balazs gave Hungary the perfect start when he scored with just six minutes gone.
But hot Swansea prospect Lee Lucas dragged the home side level with eight minutes of the first half remaining to set up an interesting second period.
It was not to be for Wales, though, with Haraszti grabbing a winner with seconds remaining.
Wales, featuring the likes of Nottingham Forest's Kieron Freeman, Reading's Jake Taylor and Fulham's Richard Peniket, next face Montenegro in a qualifying tie.