With two minutes left on the clock, County looked to be heading to safety following Graham Burke’s acute finish on 61 minutes.
But the visitors, who started the day outside the bottom four, were made to pay for a number of missed opportunities when Gills defender John Egan headed in at the back post from Doug Loft’s deep cross two minutes from time.
Brennan Dickenson curled in from close range in the third minute of stoppage time before substitute Luke Norris added a third to compound the Magpies’ misery.
The hosts had goalkeeper Aaron Morris to thank for keeping them in the game, as he brilliantly kept out Garry Thompson’s low effort and then produced a spectacular double save to deny Haydn Hollis and Jimmy Spencer shortly before half time.
Bradley Dack earlier had an effort cleared off the line for the Gills who finish the season in 12th.