Nigel de Jong scored a late winner to spare Milan's blushes in a 2-1 Coppa Italia victory over Sassuolo.
Milan lost 2-1 to Sassuolo in Serie A last week and made hard work of atoning for that unexpected defeat in Tuesday's last-16 meeting at San Siro.
Giampaolo Pazzini opened the scoring seven minutes before half-time, but Nicola Sansone threatened to make it a case of deja vu for Filippo Inzaghi's men with a 63rd-minute penalty.
However, De Jong powered home a decisive strike four minutes from the whistle to seal the win.
Milan will now meet Torino or Lazio, who play on Wednesday, in the quarter-finals.
Alessio Cerci was handed his first Milan start since arriving from Atletico Madrid on an 18-month loan deal earlier this month, but it was Sassuolo – heavily rotated from their 1-1 Serie A draw with Udinese at the weekend – who got the first sight of goal.
Leonardo Pavoletti, who has been linked with a move away from the club, controlled a long ball with his head in the Milan box, but was unable to turn and apply the finish under pressure from Cristian Zapata.
Andrea Poli – the scorer of Milan's only goal in the league meeting between the sides – blasted over at the other end as his side looked to draw first blood, but Sassuolo remained a thorn in the side of the hosts, with Ignazio Abate forced to poke the ball behind in the 20th minute to thwart a dangerous-looking counter-attack.
Pavoletti diverted wide from a low cross from the right wing shortly before the half-hour mark, and Milan forward Pazzini was similarly wayward as both sides struggled to test the goalkeepers.
However, Pazzini got his outstretched boot to a Cerci cross seven minutes before the interval to volley the ball beyond the sprawling Alberto Pomini and break the deadlock.
Cerci almost added a goal of his own soon after, but only managed to find the base of the right-hand post, while Sime Vrsaljko had a headed effort ruled out for offside with the final action of the half.
Pomini produced a superb reaction stop to keep out Pazzini five minutes into the second period, before Sansone drew a diving save from Christian Abbiati.
However, when Zapata and Pavoletti had a coming together in the Milan box midway through the second half, Sansone made no mistake in adding to the goal he scored last time out at San Siro.
Pomini palmed over a Cerci free-kick as both sides pushed for the goal that would prevent extra time, and Milan will not have welcomed the 85th-minute introduction of Simone Zaza, who secured the win for Sassuolo last Tuesday.
However, De Jong settled the tie a minute later, rifling home after Poli's volley from a free-kick had struck the underside of the crossbar to thwart Sassuolo's hopes of claiming another famous scalp.comments