Iran finished bottom of Group F as Bosnia-Herzegovina ran out 3-1 winners in their final game, in Salvador.
Edin Dzeko and Miralem Pjanic gave Safet Susic's side a comfortable-looking lead before Reza Ghoochannejad scored the Iranians' first goal of the World Cup late on.
However almost immediately, Avdija Vrsajevic went up the other end to end Iran's hopes of qualification.
See how the action unfolded below.