The Serie A clash appeared to be heading for a goalless draw, but Icardi had other ideas as the 25-year-old nodded past Italian goalkeeper Gianluigi Donnarumma in second-half stoppage time to break Milan hearts.
Luciano Spalletti's side had the better of the opportunities in the Serie A clash, and the win - Inter's seventh in a row in all competitions - has seen them move above Lazio into third position in the table.
The first half-chance of the match fell to Milan in the fourth minute, with Suso's low strike just missing the Inter post. Hakan Calhanoglu then struck wide of the home side's goal five minutes later as Milan started the better.
Inter thought that they had taken the lead in the 12th minute when Icardi converted from close range, but Matias Vecino had flicked a header towards the striker, and the offside flag was correctly raised.
Ivan Perisic then tested Milan goalkeeper Donnarumma with a header in the 22nd minute as the home side started to take control of the derby, which certainly had some bite.
Easily the best chance of the first period fell to Stefan de Vrij in the 34th minute, but the Inter centre-back saw his effort, which was extremely inventive, hit the Milan woodwork.
Mateo Musacchio had the ball in the back of the Inter net in the closing stages of the first period as Milan looked to make the breakthrough, but once again the offside flag was raised.
The referee's half-time whistle blew with the score goalless, but it was a first 45 minutes full of incident, and one where both teams had goals correctly disallowed.
Politano had the first opportunity of the second period after meeting a cross from Vecino, but the number 16's strike was wide of the post as Milan survived a dangerous moment.
Inter were the team on the front foot as the match continued to develop, although chances were few and far between, with the score still goalless entering the final 25 minutes of football.
Perisic had a low strike deflected wide of the post in the 66th minute, but the Croatian limped off the field four minutes later in what was a blow for Inter, with Keita Balde Diao his replacement.
Milan had a super chance to take the lead 10 minutes from time when Suso found space inside the Inter box, but the Spaniard could not find a route past Samir Handanovic. Suso then had a free kick deflected over the crossbar as the match headed for its final five minutes at 0-0.
There was to be more late drama in the Milan derby, however, with Icardi heading a deep cross into the back of the net after Donnarumma had lost the flight of the ball.
Next up for Inter is a trip to Barcelona in the Champions League on Wednesday night, while Milan will face Real Betis in the Europa League on Thursday.
INTER MILAN (4-2-3-1): Handanovic; Vrsaljko, De Vrij, Skriniar, Asamoah; Vecino, Brozovic; Politano (Candreva 83'), Nainggolan (Valero 30'), Perisic (Keita 70'); Icardi
AC MILAN (4-3-3): Donnarumma; Calabria (Bertolacci 92'), Musacchio, Romagnoli, Rodriguez; Kessie (Bakayoko 84'), Biglia, Bonaventura; Suso, Higuain, Calhanoglu (Cutrone 74')