Bosnia became the latest team to be eliminated from the World Cup when Stoke City forward Peter Odemwingie scored the winning goal in Cuiaba past club-mate Asmir Begovic.
But they will depart their first World Cup feeling aggrieved after Edin Dzeko had a goal wrongly chalked off for offside when the score was 0-0 and then Odemwingie’s struck in controversial circumstances after 29 minutes.
Emannuel Emenike sent Bosnia skipper Emir Spahic to the floor with a robust challenge before setting up Odemwingie to fire home from eight yards.
And in an agonising finale, Dzeko hit the post when a goal would have kept Bosnia's tournament hopes alive.
Bosnia knew there was no margin error after unluckily losing their opening game 2-1 to Argentina.
But they faced a rejuvenated Nigeria who offered a lot more than their turgid goalless draw with Iran would have suggested.
It was a bright start for Africa’s most populous nation. 21-year-old striker Ahmed Musa, who plays his club football in the Russian League with CSKA Moscow, was a whisker away from applying a finishing touch after the ball flashed dangerously across the Bosnia goal.
John Obi Mikel shot wide when well-placed – which wouldn’t surprise Chelsea fans – and Begovic was forced to tip away from Ogenyi Onazi as Bosnia were put under the cosh.
But Bosnia, who have only been members of Fifa for 18 years, were robbed of the first goal after 21 minutes when Dzeko timed his run to perfection to convert a clever through pass by Miralem Pjanic.
The City forward, with 10 goals in qualification, couldn’t believe it as he turned to celebrate and saw the linesman’s flag in the air for offside, when he’d been half-a-yard on.
Ironically, it was the only chance Dzeko put away. Four more times he had opportunities to score but was twice denied by Nigeria’s excellent goalkeeper Vincent Enyeama and twice missed the target.
Bosnia playmaker Miralem Pjanic tried to inspire his team-mates to draw level with a energetic performance in midfield.
But his low shot was saved by Enyeama late on while substitute Vedad Ibisevic, who scored against Argentina, failed to head in from a corner with Bosnia’s best chance of the second half.
Then, in injury-time, Dzeko agonisingly sent a header straight at Enyeama before sending another shot against the keeper and onto the post, leaving the Bosnia players to collapse in tears at the final whistle.