Willock smartly turned home Lewis Hall's cutback with ten minutes remaining at The Den to put Matthias Jaissle's men into the fourth round after a difficult evening against the Championship side, who pushed the Magpies all the way.
The hosts struck the woodwork through substitute Taïryk Arconte just moments before the decisive goal as United were forced to weather a second half storm from the hosts, who fed off the home crowd's fervour.
But Willock bounced home a winner in the nick of time to secure Newcastle's progress on a night when considerable discipline and resilience were required on the first meeting between the two teams since 1993.
The Magpies had the lion's share of possession in the opening exchanges but couldn't find a way of converting it into clear-cut chances, with Jacob Murphy firing over early on and Willock stinging the palms of ex-Gateshead goalkeeper Filip Marschall.
Sven Botman had a go, nodding Murphy's corner onto the roof of the net. A surge forward from Yoane Wissa - a feature of United's first few games of the season - led to his shot being charged down before Willock clipped one wide.
The hosts' only real opportunity of the half fell to centre half Caleb Taylor, who glanced an outswinging free kick from the left just off target, while five minutes before the break Fabian Schär - on his first start of the campaign - took aim from range and saw his deflected drive flash just past the upright.
Tino Livramento was introduced at half time but the Lions began the second period with intent, with a few hanging crosses narrowly evading the imposing figure of Jake Cooper in the box before Jenson Metcalfe's fierce half-volley whistled just over. Taylor then looped another header across the face of goal as Alex Neil's men continued to threaten aerially.
Marschall was called into action to deny Harvey Barnes and Matthias Jaissle brought on Anthony Elanga and Matias Fernandez-Pardo, with the duo's speed instantly lifting the Magpies. Taylor threw a leg in front of Barnes' low drive as United's set pieces began to ask questions of the Lions' rearguard.
Newcastle stopper Lukáš Horníček, meanwhile, had to move quickly to get down and keep out what would have been an own goal from Sven Botman as he inadvertently turned a Yanis Issoufou cross towards danger. Millwall then came even closer, as Marschall's long ball was chased down by Taïryk Arconte, who thumped the base of the post.
And they were made to rue that miss on 80 minutes, when Fernandez-Pardo combined with Hall on the left and Willock found space to bury his own opportunity and make sure of United's place in the draw - despite the efforts of Camiel Neghli, who dragged a decent chance wide late on.
Newcastle United: Lukáš Horníček, Lewis Hall, Sven Botman, Fabian Schär, Nico González, Yoane Wissa (c) (Matias Fernandez-Pardo 65), Harvey Barnes, Jacob Murphy (Anthony Elanga 65), Joe Willock (Sean Steur 90), Amar Dedić (Tino Livramento 46), Jacob Ramsey (Lewis Miley 84)
Substitutes: Nick Pope, Aladji Bamba, Malick Thiaw, Bazoumana Touré




