Match ends, Hampton & Richmond 1, Oldham Athletic 2.
League Two side Oldham avoided an FA Cup upset in dramatic fashion, with two late goals at Hampton & Richmond.
The National League South hosts looked on course for a famous victory after Chris Dickson's first-half penalty.
But Rob Hunt's 88th-minute equaliser pulled the Latics level, and Callum Lang scored the winner in the fifth minute of eight added on.
Frankie Bunn's Oldham will travel to National League side Maidstone in the second round.
It had looked set to be a frustrating evening for the visitors, who fell behind after referee Tom Nield controversially penalised Lang for a challenge on Tyrell Miller-Rodney.
Replays suggested contact was minimal, but former Charlton and Ghana forward Dickson put the Beavers ahead as they sought their first victory at this stage of the competition after defeats by Barnet in 2000 and Dagenham in 2007.
Dickson, who scored in the Europa League for AEL Limassol against Marseille in 2012, went close to adding a second, as did Zak Joseph.
But that would have been harsh on Oldham, who had 24 shots during the game.
George Edmundson struck a post, Peter Clarke and Jose Baxter - who later left the field on a stretcher - also missed good opportunities, and home goalkeeper Tom Lovelock was in inspired form.
But Oldham kept going forward, and Hunt converted from close range after a speedy counter-attack.
Lang then got on to Chris O'Grady's flick-on to volley home from 12 yards as Oldham secured a 23rd victory in their past 24 FA Cup first-round ties against non-league opponents.
Hampton & Richmond
- 8MaclarenBooked at 36minsSubstituted forWellardat 64'minutes
- 9DundasBooked at 90minsSubstituted forObiat 90+7'minutes
- 10DicksonSubstituted forMurrell-Williamsonat 85'minutes
- 11ConnorsBooked at 69mins
- 5LydenSubstituted forMaoucheat 80'minutes
- 11MillerSubstituted forO'Gradyat 74'minutes
- 8BaxterBooked at 26minsSubstituted forBrangerat 52'minutes
- Tom Nield
- Shots on Target
Second Half ends, Hampton & Richmond 1, Oldham Athletic 2.
Attempt missed. Rian Bray (Hampton & Richmond) header from the centre of the box is close, but misses to the right. Assisted by Ogo Obi with a cross.
Substitution, Hampton & Richmond. Ogo Obi replaces Craig Dundas.
Corner, Oldham Athletic. Conceded by Tom Lovelock.
Attempt saved. Mohammed Maouche (Oldham Athletic) right footed shot from the centre of the box is saved in the bottom left corner.
Corner, Hampton & Richmond. Conceded by George Edmundson.
Goal! Hampton & Richmond 1, Oldham Athletic 2. Callum Lang (Oldham Athletic) right footed shot from the centre of the box to the bottom right corner. Assisted by Chris O'Grady with a headed pass.
Foul by Rob Hunt (Oldham Athletic).
Jack Connors (Hampton & Richmond) wins a free kick in the defensive half.
Corner, Oldham Athletic. Conceded by Craig Dundas.
Corner, Oldham Athletic. Conceded by Tyrell Miller-Rodney.
Craig Dundas (Hampton & Richmond) is shown the yellow card for a bad foul.
Dan Gardner (Oldham Athletic) wins a free kick in the attacking half.
Foul by Craig Dundas (Hampton & Richmond).
Attempt blocked. Johan Branger (Oldham Athletic) right footed shot from the centre of the box is blocked. Assisted by Cameron Dummigan with a cross.
Corner, Oldham Athletic. Conceded by Rian Bray.
Attempt saved. Johan Branger (Oldham Athletic) left footed shot from the left side of the box is saved in the bottom left corner. Assisted by Chris O'Grady.
Goal! Hampton & Richmond 1, Oldham Athletic 1. Rob Hunt (Oldham Athletic) left footed shot from the centre of the box to the top left corner. Assisted by Dan Gardner following a fast break.
Attempt missed. Zak Joseph (Hampton & Richmond) right footed shot from the centre of the box misses to the left. Assisted by Jack Connors following a set piece situation.