More on KentOnline
Gillingham are in Monday's draw for the second round of the FA Cup after edging past Leyton Orient at Priestfield.
Josh Parker's first-half goal put Gills ahead as they totally dominated against their non-league opponents.
But Orient were a different side after the break and it needed a Tom Eaves strike late on to double Gillingham's lead before the visitors set up a tense finale by pulling a goal back.
Gills made two changes from the league victory at Rotherham seven days earlier. Injury meant they were without Billy Bingham and Bradley Garmston, but Mark Byrne and Connor Ogilvie proved able deputies.
The home side needed a morale-boosting win at Priestfield, where they had only enjoyed one success to date this season - 1-0 against Charlton in September.
They dominated the opening 45 minutes and should have led by more at the break, such was their dominance.
Parker and Eaves both had low shots comfortably saved by Orient keeper Charlie Grainger before the hosts took a 20th-minute lead.
Elliott List had picked the wrong option on a couple of earlier occasions but he delivered when it mattered, cutting back on his left foot and crossing for the unmarked Parker to nod in from close range with the Orient defence nowhere to be seen.
Eaves fired an excellent cross along the six-yard box but no-one was there to touch it home, Parker's cross was too high for skipper Lee Martin and List's cross-shot was a yard wide of the far post as Gills continued to dominate.
Chances and possession belonged to the hosts, who played the ball to feet, switched it well when they could and had National League Orient on the back foot.
Keeper Grainger went into referee John Brooks' notepad 10 minutes before half-time as he clattered into List on the edge of the box. Grainger might have seen red in previous seasons but it was yellow and the free-kick by Max Ehmer was deflected away to safety.
Gills had a penalty appeal turned down on 39 minutes when they broke on the counter attack. The ball was worked by Jake Hessenthaler into List, who went down as he shaped to shoot but Brooks waved away Gillingham's claims.
Orient replaced Michael Clark with Alex Lawless at the break and immediately showed more intent, skipper David Mooney turning a left-wing cross over the bar on 48 minutes and Macauley Bonne going even closer moments later.
The visitors looked a different team after the break. They switched to a 4-4-2 formation and, being a cup tie, played as if they had nothing to lose.
Gills keeper Tomas Holy was a virtual spectator in the first half but he earned his wages after the break.
He did well to turn aside Bonne's header, even though the referee generously gave Gills a goal kick.
Then it was two fine saves in the space of a minute. Mooney's dipping volley was turned behind for a corner, from which Jamie Sendles-White was left unmarked and his close-range header was brilliantly clawed out by the giant keeper.
Gills looked to have put the tie beyond the visitors with 16 minutes left. Eaves shrugged aside the challenge of centre-back Sendles-White and fired low beyond Grainger.
It was to be Eaves' last act as Conor Wilkinson came on straight away to replace him.
Orient responded, however, and it was game on with 11 minutes remaining as a free-kick from out wide crept in at the far post, Hayton being credited with the goal.
A fracas saw a flurry of bookings and the odd tasty challenge as Gills tried to see the game out and book their place in round two.
Parker nearly added a third but his volley was blocked by Jake Caprice.
The visitors finished with 10 men when Joe Widdowson picked up two yellow cards in the space of six minutes. The first for a foul on Wilkinson, the second when he pulled back the Gills striker on the edge of the penalty area two minutes into stoppage time.
Gillingham: Holy, Clare, Ogilvie (O'Neill 79mins), Ehmer, Zakuani, Byrne, Hessenthaler, Martin, Parker, Eaves (Wilkinson 75mins), List (Wagstaff 57mins). Subs not used: Arnold, Mbo, Chapman, Cundle.
Leyton Orient: Grainger, Caprice, Widdowson, Bonne, Mooney, Boco (Harrold 69mins), Judd, Clark (Lawless 46mins), Dayton, Westbrooke (Sotiriou 87mins). Subs not used: Sargeant, Pollock, Dalby, Clay.
Attendance: 3,659 (818 away).