Fiorentina needed a Tofol Montiel goal in extra time to beat Udinese and set up a Coppa Italia clash with Inter, but Spezia stunned Bologna in a 4-2 thriller.
The Viola got their first win under new coach Cesare Prandelli, although it was again a long way off an impressive performance.
They had to play 113 minutes at the Dacia Arena before finding a breakthrough and just about avoiding a penalty shoot-out.
Patrick Cutrone set up Montiel’s left-foot finish to secure the victory and set up a Round of 16 match against Inter.
Bologna and Spezia also went to extra time, but this was a far more entertaining and chaotic encounter.
It was a topsy-turvy match with Spezia taking the early lead through Roberto Piccoli, caught by Musa Barrow.
Riccardo Orsolini put Bologna in front, only for Diego Farias to equalise for Spezia.
Bologna thought they’d won it in normal time when a penalty was awarded, but Barrow’s effort was parried by the goalkeeper, Titas Krapikas.
It went to extra time and Spezia emerged in the long run, with Giulio Maggiore bagging a brace.
Spezia will now face Roma in the Round of 16 in January.
Bologna 2-4 Spezia aet
Piccoli 5 (S), Barrow 13 (B), Orsolini 45 (B), Farias 64 (S), Maggiore 100, 119 (S)
Udinese 0-1 Fiorentina aet
Montiel 112 (F)