Fredy Guarin and Rodrigo Palacio had earlier put the Nerazzurri 2-0 up with 13 minutes left to play. However, two goals in three minutes from Alessandro Diamanti and Manolo Gabbiadini rescued the Rossoblu and sent the San Siro tie into extra time.
Both teams came out wearing special jerseys remembering Arpad Weisz, the Coach who won titles at Inter and Bologna before he was killed at Auschwitz in 1944.
The home side gave Tommaso Rocchi a first start since his move from Lazio and kept faith with 18-year-old Marco Benassi, after the teenager made his debut against Pescara at the weekend. Surprisingly, there was no place in the squad for another youngster, Marko Livaja.
A second string Bologna knocked out defending champions Napoli in the previous round, but Stefano Pioli named a stronger lineup for this tie.
The game was a great advert for attacking Football, as both teams came charging out of the gate. Juan Jesus had to defend an Alberto Gilardino lob, while Marco Motta headed straight at Samir Handanovic.
Antonio Cassano pulled the strings for the home side. Inside the first ten minutes, he got into a dangerous position, but waited too long before letting off a disappointing shot wide. Matias Silvestre then headed a Cassano free kick off target.
At the other end, Cristian Pasquato and Archimede Morleo all combined with Diamanti to shoot just wide of the post. The dangerous former West Ham man then slipped Pasquato in to shoot hard and low at Handanovic.
Cassano fired another warning when he stepped into the area and sent a dipping shot just past Federico Agliardi and the far post. Moments later, Inter opened the scoring. Cassano rolled the ball across the edge of the area for Guarin to control and unleash a rocket into the top corner, giving Agliardi no chance.
As half time drew close, Handanovic was kept busy, palming clear a Gilardino header and beating away a dangerous Diamanti effort from long range, which dipped right in front of him.
Handanovic was called into action again early in the second half, punching clear Diamanti's free kick before Frederik Sorensen could pounce. On the hour, Michele Pazienza blazed over from close range, following Guarin's botched clearance.
Palacio failed to take advantage of an Agliardi fumble. The goalkeeper redeemed himself by using his body to prevent Alvaro Pereira's cross from reaching Palacio.
Inter's second goal wasn't without controversy. Guarin hoofed the ball upfield as it rolled across the touchline. Bologna were adamant the ball had gone out, but the referee waved play on, allowing Palacio to collect it, turn two markers and curl a beautiful shot into the top corner.
Bologna remained incensed at the decision, but their mood calmed on 81 minutes. Diamanti left Handanovic rooted to the spot as he curled his free kick up and over the wall into the top corner.
All of a sudden, the Nerazzurri looked shaky. Ranocchia almost registered an own goal, heading Morleo's delivery towards his own goal. Luckily for him, the ball bounced off the post and was caught by a relieved Handanovic. The equaliser did come when Gabbiadini tapped home Motta's pinpoint cross, taking advantage of some really poor defending from Jonathan.
As the minutes ticked away, Ranocchia had a header disallowed for offside and sent an overhead kick wide. Handanovic palmed a Gabbiadini curler around the post, while Agliardi tipped a deflected Palacio cross onto the roof of the net. Pazienza fired one final shot wide before the whistle went, and the sparse San Siro crowd were allowed to briefly regain their breath.
Inter dominated the first half of extra time. Esteban Cambiasso scuffed a shot wide and headed over a Cassano free kick after being put under pressure by Daniele Portanova. Agliardi was forced to push away a dangerous Cassano cross and Morleo threw his body in the way to block a Guarin delivery into the box. Cassano had to go off to get treatment for a hamstring injury, while Motta saw his low cross cut out by the Inter defence right on the referee's whistle.
Cassano came back onto the field, albeit in a limited capacity for the second period. 39-year-old Javier Zanetti went on a mazy run, holding off three defenders before drawing a fine stop out of Agliardi. The ball rebounded back off the Inter captain, striking a post and rolling wide. Gabbiadini missed a couple of chances to win it. First he headed a weak effort into Handanovic's gloves from only a few yards out. The winger then found space on the edge of the area and drilled his shot into the side netting.
The game was all set for penalties when Ranocchia struck the killer blow. Agliardi was caught in no mans land and went to ground as the defender rose highest to meet Guarin's corner. The Bologna defenders jumped in vain as Ranocchia's header looped over them and into the empty net.
Inter Milan: Handanovic; Ranocchia, Silvestre, Juan Jesus; Jonathan, (Mudingayi 87) Benassi, (Cambiasso 46) Pereira, Zanetti; Guarin; Rocchi, (Palacio 60) Cassano
Bologna: Agliardi; Sorensen, Portanova, Antonsson; (Kone 70) Motta, Perez, Guarente, (Pazienza 46) Morleo; Diamanti, Pasquato; (Gabbiadini 55) Gilardino
Goals: Guarin 34 (I) Palacio 77 (I) Diamanti 81 (B) Gabbiadini 84 (B) Ranocchia 120 (I)