Mayer, a 20-year-old native of Franklin, Wisc., got around Parker Kligerman for the lead exiting Turn 14 and just before the start of the final lap of double overtime.
Mayer then deftly navigated the 4.048-mile course one last time and held off Kligerman by a scant 0.368 seconds to earn his first career win in his 71st start.
Mayer’s chance at the win came after his JR Motorsports teammate Justin Allgaier – who won both stages and led 42 of 49 laps – went wide and off course on the restart of the second overtime.
Sage Karam then inherited the lead but was passed by Kligerman who was then passed by Mayer – all in the same lap.
“Oh my God, I can’t believe it,” said Mayer. “We had it there, then lost it for a second and then all hell broke loose there at the end. It’s so special to get that first win and get that monkey off your back. It feels so good.
“I felt it all day. I felt like if I can do this one, I can do anything, and we came here today and did that. All’s well that ends well, I guess.”
The win locks the former ARCA Menards Series champion into this season’s playoffs, although he was in a good position in points to make the field regardless.
Austin Hill ended up third, Karam fourth and Riley Herbst rallied from an early-race wreck to finish fifth.
Completing the top-10 were Josh Berry, Kaz Grala, Josh Bilicki, A.J. Allmendinger and Brandon Jones.
Stage 1
Allgaier claimed the Stage 1 win over Cole Custer under caution when Chandler Smith lost a brake rotor and slammed hard into the Turn 1 wall with two of 22 laps to go.
A massive hit for @CSmithDrive after losing his brakes, but seems he went into the wall on purpose to avoid going head on into turn one at full speed.
— Xfinity Racing (@XfinityRacing) July 29, 2023
Smith is out of the car under his own power. pic.twitter.com/h0hwTnVICA
Allmendinger was third, John Hunter Nemechek fourth and Karam rounded out the top five.
Katherine Legge, making his first NASCAR start since 2018, stalled on the track on lap 10 which brought out a planned competition caution a lap early.
Stage 2
Allgaier held off Custer by 0.284 seconds in a one-lap dash to the finish and earned the win in Stage 2. Karam was third, Allmendinger fourth and Mayer was fifth.
The one-lap restart was set up after Nemechek went off course late in the 12-lap stage which tore the front splitter off his No. 20 Toyota and dumped fluid all over the track. He eventually retired from the race.
Stage 3
Allgaier remained out front to start the final 11-lap stage followed by Custer and Karam.
Custer went wide on the restart with nine laps remaining which allowed Karam to move into second and Mayer to third.
Mayer got around Karam to claim the runner-up spot one lap later.
Alex Labbe sailed through the sand trap in Turn 1 and ended up stuck in the tire barriers to bring out a caution and set up a restart with four laps to go.
Entering Turn 5 after the restart, Berry got into Sammy Smith, who got turned sideways and collected both Allmendinger and Custer.
Xfinity Series cars were like pinballs as @SageKaram BARELY squeezes through! pic.twitter.com/K0GPJFg8VB
— Xfinity Racing (@XfinityRacing) July 29, 2023
The incident sent the race into a two-lap overtime with Allgaier still out front followed by Mayer and Karam.
Connor Mosack developed engine problems on the restart, dropped fluid on the track and eventually stalled to send the race into a second overtime after a nearly 10-minute red-flag to clean the track.