Mathieu Flamini played both hero and villain as he scored to briefly cut Napoli's lead over third place to a single point at San Siro before seeing red for a reckless challenge on Juan Camilo Zuniga in the second half.
The Azzurri were hoping to maintain their pursuit of Serie A leaders Juventus but Pandev's equaliser was only enough to cut the gap to eight points with six games remaining.
Morgan De Sanctis survived an early scare as Kevin-Prince Boateng's shot ricocheted off Paolo Cannavaro to streak towards the far corner, the Napoli keeper sticking out his trailing hand just in time.
The Rossoneri pressed on and Boateng volleyed Zapata's cross wide moments after the Colombian defender had missed a free header.
The first penalty call of the night came when Flamini appeared to control Marek Hamsik's cross with his arm, but referee Gianluca Rocchi was unmoved.
Pandev and Edinson Cavani soon threatened, the latter blasting high and wide after Philippe Mexes had closed down the Macedonian, but on the half-hour mark it was Milan who took the lead.
A neat exchange of passes between Giampaolo Pazzini and Robinho saw the ball roll into Flamini's path on the edge of the box.
The former Arsenal man wasted no time in arrowing a pinpoint drive into De Sanctis' bottom corner but, three minutes later, Napoli drew level.
Hamsik stunned a packed San Siro with a surging dribble down the flank that preceded a deft pass across the box for Pandev to collect and rattle home on the run.
Milan were denied the chance to wrest back the lead almost immediately when Rocchi saw nothing wrong with Miguel Angel Britos' bodycheck on Pazzini in the box.
Boateng pulled up injured to be replaced by M'Baye Niang before Cavani produced one last moment of real danger before the break.
The Uruguayan controlled a ball over the top with a sumptuous touch before lobbing Christian Abbiati, the Milan keeper only just managing to clear.
Abbiati needed to look alive again as play resumed, with Cavani winning a foot race against Zapata only to watch the ball being swept off his feet.
The early fizz did not carry over the interval and Robinho's misplaced cross from the corner flag inspired frustrated whistles from the home crowd.
A swift Milan counter-attack proved slightly more entertaining on the hour mark but Pazzini could not provide the killer pass for Niang.
Then, with 73 minutes on the clock, Flamini launched an out-of-control tackle at Zuniga to earn himself a red card and leave Milan a man light for the final throes.
Rocchi waved play on again as Napoli demanded a penalty for a presumed Zapata handball before substitute Emanuele Calaio bulleted a header wide of the mark deep into stoppage time.