Bradley Dack's volley in the seventh minute of injury time rescued Gillingham and denied Brackley a famous FA Cup first-round scalp.
Conference North Brackley were nearly ahead after four minutes when Steve Diggin hit the crossbar with a volley.
But they took the lead through Joe Martin's 69th-minute own goal.
Town looked to be heading to the second round for the first time in their history but Dack latched onto Adebayo Akinfenwa's header to deny them.
VIEW FROM THE DRESSING ROOM
Gillingham interim manager Peter Taylor told BBC Radio Kent:
"It was not what we are looking for, we want better than that, but the FA Cup always has shocks.
"We kick-off and Brackley, who did ever so well and deserve credit, had a great move in the first minute and it made our players even more nervous.
"On the plus side we kept going, and that's the most important thing.
"(About the manager's job) I haven't discussed that. We only spoke very quickly about the performance and the goal, that's about it. But I don't want to hear anything about that at the minute."
Gillingham 01 Nelson 23 Harriman Booked 03 Martin 07 Whelpdale 05 Davies (Akinfenwa - 66' ) 26 Barrett Booked 11 Weston (Dack - 66' ) 12 Gregory 10 McDonald 09 Kedwell 18 Lee Booked (Mousinho - 67' ) Substitutes 08 Akinfenwa 15 Dack 16 German 20 Carter 21 Howard 31 Hessenthaler 32 Mousinho Brackley Town 01 Turley 02 Reid Booked 03 McDonald (Nisevic - 45' ) 04 Towers 05 Sharpe 06 Austin 07 Sandy 08 Solkhon 10 Diggin (Jarvis - 89' ) 09 Mulligan (Mills - 70' ) 11 Walker Substitutes 12 Story 14 Nisevic 15 Odhiambo 16 Mills 17 Worby 18 Jarvis 19 Griffin
Ref: Lee Collins