The Partenopei ensured their former coach left the Stadio San Paolo with nothing after Rafa Benitez's side emerged victors in a six-goal thriller.
Rafael Benitez's side were consigned to a place in the Europa League in midweek despite beating Arsenal 2-0, but they showed an excellent response to that heartbreak.
All five goals came in a frantic first half in former Napoli coach Mazzarri's first return to the Stadio San Paolo since he departed for Inter in May.
Gonzalo Higuain opened the scoring with his 12th goal of the season, but Esteban Cambiasso leveled before Dries Mertens and Blerim Dzemaili struck in the space of two minutes to stun Inter.
Yuto Nagatomo pulled a goal back just before halftime, but Ricky Alvarez was sent off for a second bookable offense as Mazzarri’s side suffered its first defeat in 10 games,
The win was wrapped up by Jose Callejon’s late effort, while Samir Handanovic magnificently saved former Inter striker Goran Pandev's penalty in the dying embers of the game.
Victory for Napoli moved it just two points behind second-placed Roma, which plays Milan on Monday and gave Benitez a win against one of his former employers.
Rodrigo Palacio squandered a golden opportunity to put Inter in front after five minutes when he inexplicably headed over the bar from close range.
And he was made to pay for that miss four minutes later, when Nagatomo's poor defensive header looped up nicely for Higuain and the Argentina striker let fly with a left-footed volley.
Insigne then rattled the post with a well-struck drive when he was set up by Mertens after 26 minutes, but Inter leveled shortly after.
Fredy Guarin put in a cross from the right on 34 minutes which was dummied by Palacio and helped on by Alvarez for Cambiasso, who finished clinically with his left foot.
Napoli then hit back with two goals in as many minutes. First, Mertens raced forward to smash home a loose ball after Dzemaili had surged through the midfield 39 minutes in.
And Switzerland international Dzemail chipped in with a goal of his own from close range, two minutes later, after Samir Handovic could only push Mertens' shot into his path.
Inter refused to lie down and it was given a lifeline in first-half stoppage time as Guarin fired across the face of goal, where Nagatomo was on hand to provide a simple finish.
Callejon fired just wide and Rafael denied Guarin from close-range as Napoli turned the screw after the break.
Inter's hopes of salvaging anything looked remote when Alvarez was shown a second yellow card for handball with 19 minutes remaining.
And Napoli duly sealed the points nine minutes from time when Callejon turned home from close range, although Handanovic kept the margin of defeat at two goals by saving a Pandev penalty in injury time.