Denny Hamlin led the way entering the second, two-lap overtime but Chase Briscoe ran off course and cut the track and was immediately handed a penalty by NASCAR.
Briscoe, however, continued racing on the track and battled Hamlin hard for the lead, hitting him in the right-rear corner and spinning him.
Allmendinger, running third at the time, inherited the lead and ended up holding off Ryan Blaney by 0.929 seconds to win the Cup series’ first race on the 2.439-mile, 14-turn road course at Indianapolis Motor Speedway.
“I was so mad yesterday – I wanted to win so bad! This is unbelievable,” Allmendinger said. “We had to fight hard. Robin Miller – I saw him this morning – this one’s for you baby, and Bob Jenkins.
“I just won Indy … I just won Indy!”
Allmendinger currently competes fulltime for Kaulig Racing in the Xfinity Series but has been driving a partial Cup schedule for the organisation as well.
The win is the second of Allmendinger’s Cup career, his first coming in 2014 at Watkins Glen with JTG Daugherty Racing.
“It was survival of the fittest,” Allmendinger said. “We probably had like an eighth-, 10th-place car, sped on pit road. I thought we were going to finish 12th to 15th, and then those restarts were just insane.
“It’s great when you have a car owner that just says, ‘Go get me trophies’. He doesn’t care if that thing is torn up. Chevy, ECR horsepower, RCR, everybody that allows us to do that, all of our sponsors on the Xfinity side of it, we just won at Indy.”
Kyle Larson ended up third, Chase Elliott fourth and Matt DiBenedetto rounded out the top five.
Completing the top 10 were Kurt Busch, Erik Jones, Justin Haley, Austin Cindric and Ryan Newman.
Hamlin ended up 23rd with Briscoe 26th and one lap down after his penalty for cutting the course.
“To me just lack of situational awareness,” Hamlin said. “I’m not like furious. It just sucks. Turned our day upside down.”
The race was marred by repeated instances of damage to the kerb at Turn 6, which initially led to a caution period in the third stage when a part of a car’s splitter got wedged underneath it, before later there were two red flags.
On lap 78, erstwhile leader Larson went over the kerbing in Turn 6, which came apart. William Byron was the next car over the kerb and it tore his radiator out, which also dropped fluid over the track.
Joey Logano subsequently slammed into the tyre barrier and Kyle Busch, Daniel Suarez, Christopher Bell and Kevin Harvick also were caught up in the incident. The race was immediately red-flagged.
After a nearly 20-minute red flag, which included the removal of the troublesome kerb and replacement of a section of tyre barrier, the race returned to caution.
The race went into a two-lap overtime. On the restart, Hamlin led the way followed by Larson, Briscoe, DiBenedetto and Blaney.
On the restart, Michael McDowell went over the remaining kerb at Turn 6, which launched him around and set off another multi-car wreck and a second red-flag. Larson caught a piece of that accident and was relegated back to seventh.
Hamlin led on the start of the second overtime, followed by Briscoe, Allmendinger, DiBenedetto and Blaney.
Earlier, Tyler Reddick held off Austin Dillon to complete a sweep of wins in the first two stages.
Byron started the race from pole and led the first lap but Briscoe got around him on lap two to move into the lead.
With 10 laps remaining in the opening stage, Briscoe had built more than a half-second lead over Byron as Elliott ran third, but Briscoe later collected some grass on his grille.
Result – 95 laps