Jose Callejon looked to have earned the Partenopei all three points with his 90th-minute strike but the Nerazzurri's Brazil international headed home a last-gasp equaliser
Hernanes came to Walter Mazzarri's rescue with a late equaliser to earn Inter a 2-2 draw with Napoli in Serie A on Sunday.
The Brazilian had wasted two good chances in the first half but made no mistake with a stoppage-time header, guiding it past Rafael to earn the hosts a point in a dramatic finale.
His strike ensured Inter avoided a third successive league defeat after a largely frustrating night at San Siro, with all four goals coming late on.
Napoli barely threatened the Inter goal but took the lead with 11 minutes to play as Jose Callejon netted his fifth league strike of the season.
Substitute Fredy Guarin brought Inter level 70 seconds after coming on, with Callejon restoring Napoli's lead in the final minute.
However, the drama was not over as Hernanes header from Dodo's cross ensured the spoils were shared.
Napoli, who recalled Marek Hamsik for Michu as one of three changes, had the first sight of goal in the 12th minute, but Camilo Zuniga's shot was easily saved by Samir Handanovic.
That was as close as the visitors came, though, as they struggled to get a foothold into the game.
After 18 minutes Hernanes, one of three Inter players recalled to the starting line-up, showed his creative skills to thread a cute through ball into Mauro Icardi, but the forward saw his shot deflected over the crossbar by Raul Albiol's challenge.
Another chance fell the striker's way five minutes later, as Dodo delivered a pinpoint cross from the left. Icardi got in front of his marker inside the penalty area, but he failed to get enough on his header and Rafael saw the ball wide.
Hernanes' influence was steadily increasing and, after wasting two opportunities, the Brazilian went closest to scoring six minutes before the interval.
Having chested the ball down on the edge of the penalty area the attacking midfielder fired a low shot that beat Rafael, but the goalkeeper was saved by his post.
Rafael Benitez's half-time team-talk appeared to have had the desired effect in the opening five minutes of the second half as Napoli provided more of an attacking threat, with Lorenzo Insigne scuffing a shot wide.
Inter quickly resumed their control of the game, but Napoli, having caused so little threat in the match, stunned the San Siro crowd with the opening goal from Callejon.
The hosts' defence failed to deal with a long throw-in and were immediately punished as the forward fired beyond Handanovic to give the visitors a surprise lead.
That was short-lived, though, as Guarin played the role of super-sub, ghosting in at the back post to meet Rodrigo Palacio's flick and fire past Rafael.
Just when Inter thought they had earned themselves a point another poor piece of defending handed Callejon another sight of goal, the 27-year-old volleying home David Lopez's pass.
Inter poured forward in search of a late equaliser, and they were rewarded as Hernanes timed his run perfectly to head Dodo's cross into the bottom corner.
Substitute Ibrahima Mbaye even had time to win it for Inter, but the youngster fired wide with the last kick of the game.