The former Sunderland youngster put the ball into his own net to break the League One team's resistance, with full debuts given to Siem de Jong and Rolando Aarons
The 21-year-old will doubtlessly have been looking to get one over on his old club's rivals but ended up contributing the game's defining event at the wrong end of the pitch in the first half.
Gillingham had started promisingly and looked set to cause their Premier League visitors problems, only for Egan's moment of misfortune - the Irishman turning past his own goalkeeper at the near post - to halt their momentum.
Peter Taylor's side, who beat Yeovil Town to book a place in round two, provided a good account of themselves but Tim Krul remained largely untested in the Newcastle goal.
It was the away side who, unsurprisingly, created the better of the chances and only the woodwork denied Massadio Haidara a memorable first goal for the club after the break.
Siem de Jong and Rolando Aarons were handed full debuts for Newcastle in a starting line-up that included five internationals, underlining the scale of the challenge facing Taylor's charges.
Yet Gillingham, beaten 4-1 by Barnsley on Saturday, saw early appeals for a penalty waved away when Cody McDonald went to ground under a challenge from Fabricio Coloccini, with referee Oliver Langford unmoved.
Gabriel Obertan demonstrated his pace with a quick break at the other end 15 minutes in but Mehdi Abeid dragged an effort wide after collecting a pass from the Frenchman.
The opener arrived eight minutes later as Obertan's delivery was diverted past Stephen Bywater by the helpless Egan.
It was perhaps a little harsh on the League One outfit following a solid start and it provided a spur for the visitors, who suddenly looked much more dangerous.
After seeing De Jong find the grateful arms of Bywater from Obertan's cut-back, the home side created their best opening when Matt Fish curled a superb effort just past the top-left corner of Krul's goal.
The lively Obertan spurned an opportunity to extend the lead five minutes before the interval as his heavy first touch made a potentially tricky situation very easy for Bywater.
Alan Pardew will have been keen to avoid extra time and saw his side go close to taking a two-goal lead in spectacular fashion when Haidara hit the crossbar from 30 yards early in the second half.
A previously boisterous home crowd began to quieten as Gillingham's challenge faded and they became resigned to their fate, though substitute Luke Norris did force a smart save from Krul late on.