Two goals in less than 10 first-half minutes from Andy Barcham on Tuesday booked Gillingham an FA Cup third-round tie at home to Barclays Premier League Aston Villa.
League Two Gillingham were trailing 1-0 after Stephen Gleeson (17) gave their second-round replay hosts Stockport the lead.
But the Gills overturned the scoreline and the form book, Barcham striking in the 25th and 34th minutes for an advantage which was never relinquished.
Ipswich must wait for a replay between Chesterfield and non-league Droylsden to discover who will be their third-round opponents next month, after a 2-2 draw at Saltergate.
The Spireites twice went in front, via Jamie Ward (31) and then Jack Lester (79). But each time Droylsden would not be denied, Alex Brown (50) the first equaliser and Steve Halford (82) doing the trick for a second time.
Peterborough secured a third-round clash with Premier League West Brom with an extra-time win over Tranmere at Prenton Park.
The home side looked to have done enough with Antony Kay's goal two minutes into the second half, but Aaron Mclean forced extra-time with a 90th-minute equaliser.
Craig Mackail-Smith then grabbed the winner with six minutes of extra-time remaining.
Copyright (c) PA Sport 2008, All Rights Reserved.