Senegal had made a dream start when Habib Diallo struck in the fourth minute from a Sadio Mane cross.
The Elephants' quarter-final on Saturday (17:00 GMT) will pit them against Mali or Burkina Faso, who play their last-16 tie in Korhogo on Tuesday (17:00 GMT).
Ivory Coast, who squeezed into the last 16 as one of the best third-placed teams from the group phase, grew into the match against The Teranga Lions, despite going behind so early.
Diallo, a forward for Saudi Pro League club Al Shabab, profited when Mane swung in an impeccable delivery from the left, bringing the ball down with his chest and firing it into the roof of the net to open the scoring.
Mane was lucky to escape with a caution for a rash challenge five minutes later on Nottingham Forest midfielder Ibrahim Sangare, who had to be stretchered off for treatment before coming back on.
The Elephants began to settle into the game after such a frenetic start, enjoying far more of the first-half possession and pushing for an equaliser, with Seko Fofana and Oumar Diakite both looking lively.
The 2015 champions trailed at half-time despite controlling play in a much-improved display on htheir sorry showing against Equatorial Guinea a week earlier, when they suffered their heaviest ever home defeat in a 4-0 trouncing.
Senegal started the second half as they had the first, Ismaila Sarr's shot across goal forcing a fingertip save from the diving Yahia Fofana.
Winger Sarr was again at the heart of the action when he felt he had been brought down in the box by Odilon Kossounou, with a Video Assistant Referee (VAR) check deciding there was not enough contact for a penalty to be given.
Ivory Coast's interim coach Emerse Fae, an emergency appointment following the dismissal of Jean-Louis Gasset last week, brought on forward Sebastian Haller and midfielder Frank Kessie - and the latter made an immediate impact, having a header saved by Edouard Mendy before failing to capitalise on the rebound.
Another substitute, former Arsenal man Nicolas Pepe, also brought a new energy to the hosts, running in behind on two occasions, only to shoot straight at Mendy.
And Pepe proved instrumental in Ivory Coast's equaliser when he was brought down by Mendy in the box.
Gabonese referee Pierre Atcho initially waved off appeals for a penalty, much to the frustration of the home fans and players.
VAR sent Atcho to the monitor - with Senegal coach Aliou Cisse and one of his assistants picking up a yellow card for their protestations.
Atcho reversed his decision, awarding a spot-kick to Ivory Coast which Kessie duly despatched to Mendy's left, sending the Charles Konan Banny de Yamoussoukro Stadium into raptures.
After an absorbing 90 minutes, the first period of extra-time also proved eventful.
Ivory Coast, who had restored their self-respect by pushing the holders, saw two glorious chances go awry, Brighton winger Simon Adringa and Forest's Serge Aurier both missing the target.
At the other end, Mane latched onto a cross to force an instinctive save from Fofana with a shot.
Mane and Pepe were again involved in half-chances in the second period of extra-time but no winner could be found, with Haller, who has been on the comeback trail following an injury, also missing when given a sniff of goal during the dying seconds.
It was left to a penalty shootout to determine whether Senegal - the only side at this Nations Cup to have won all three of their group games - or Ivory Coast, who had never lost three matches in a row at a single tournament, would progress to the quarter-finals.
Kalidou Koulibaly and Pape Matar Sarr both scored their penalties, with Nicolas Pepe and Christian Kouame matching their opponents.
But a miss from Moussa Niakhate handed Ivory Coast the advantage. Sebastien Haller and captain Serge Aurier then scored theirs as much of the crowd willed them on.
Mane kept the shootout alive, blasting his finish past Fofana. But up stepped Kessie to deliver the ultimate redemption for the host nation, who march on to the quarter-finals.
Newer articles
<p>A US judge has ruled against Donald Trump getting his hush money conviction thrown out on immunity grounds.</p>