Algeria blew a 1-0 lead and a penalty in regulation time before scraping past Ivory Coast in a shootout to make the semifinals at the African Cup of Nations on Thursday.
The quarter-final finished 1-1 after extra time with Sofiane Feghouli giving Algeria a 20th-minute lead that was cancelled by Jonathan Kodjia on 62 minutes.
In the shootout, Youcef Belaili struck the woodwork when he had a chance to clinch victory for Algeria, then Ivory Coast captain Serey Die hit the same post and his team were eliminated.
Forward Bounedjah missed a penalty in the second half of regular time and was visibly upset by his failure, fearing it would cost Algeria a first last-four place since 2010.
Algeria retained the team that started a last-16 demolition of Guinea, a result which confirmed the belief of many rival coaches that the Desert Foxes are the team to beat.
Ivory Coast coach Ibrahim Kamara, changed two of the side that began an unimpressive 1-0 win over Mali in the first knockout round.
Midfielder Ibrahim Sangare and forward Max-Alain Gradel were selected to start in place of Jean-Philippe Gbamin and off-form Nicolas Pepe.
This was the eighth Cup of Nations meeting between the countries with Ivory Coast holding a 3-2 lead and two matches drawn.
Ivory Coast were more impressive in the early exchanges before a modest crowd in a stadium overlooking the Suez canal, a major shipping link between the Red Sea and the Mediterranean.
Algeria goalkeeper Rais Mbolhi finger-tipped a Gradel shot on to a post and Kodjia wasted a chance from close range after a cutback in 38 celsius (100 fahrenheit) heat.
Serge Kanon was the next Ivorian to squander an opportunity to put the two-time champions in front, stabbing the ball wide from inside the six-yard area.
Against the run of play, Algeria went ahead when Feghouli connected with a Ramy Bensebaini cross and his snap shot flew past Sylvain Gbohouo.
Algeria had a great chance to go further ahead early in the second half when Bounedjah was fouled by Gbohouo, but he blazed the penalty against the crossbar and over.
The Ivorian Elephants were playing much better than in previous matches and equalised just past the hour mark, ending a 422-minute run by Mbolhi without conceding a goal in Egypt.
Crystal Palace flier Wilfried Zaha created the goal with a surging run down the middle from the centre circle before passing to Kodjia, who scored with a shot from just inside the box.