The Philadelphia Phillies appeared to be heading towards a commanding 3-1 lead in the National League Championship series on Friday night, but the Arizona Diamondbacks had other plans.

Phillies manager Robert Thomson elected to bring closer Craig Kimbrel into game in the 8th inning, just one day after he gave up the game winning run to the D-Backs in the ninth inning of Game 3. Kimbrel, who had 23 saves during the regular season, gave up a leadoff double to Lourdes Gurriel on Friday night.

Evan Longoria then flied out to left, before pinch-hitter Alek Thomas stepped into the batter's box. The 23-year-old Diamondbacks outfielder then crushed a two-run homer to tie the game.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Alek Thomas hits two-run homer

Alek Thomas #5 of the Arizona Diamondbacks hits a two-run home run against the Philadelphia Phillies in the eighth inning during Game Four of the National League Championship Series at Chase Field on October 20, 2023 in Phoenix, Arizona. (Norm Hall/Getty Images)

"That play is definitely something you see in your dreams," the 23-year-old Thomas said. "So for it to come in real life, for it to happen to me, it’s awesome. Just so grateful to have that moment."

A few batters later, Arizona catcher Gabriel Moreno drilled the go-ahead RBI single in front of the raucous crowd inside Chase Field.

OVER 60 YEARS OF MVPS: A LIST OF ALL MLB WORLD SERIES MVP AWARD WINNERS THROUGH THE YEARS

The retractable roof at the D-Backs home ballpark was closed for Game 4 after temperatures reached a record 104 degrees in Phoenix on Friday.

Kyle Schwarber, whose fourth-inning homer sparked Philadelphia's comeback from a 2-0 deficit, doubled with two outs in the ninth off Paul Sewald, Arizona’s eighth pitcher. Sewald struck out Trea Turner for his fifth save of the postseason.

Diamondback players celebrate after NLCS game

Alek Thomas #5 and Geraldo Perdomo #2 of the Arizona Diamondbacks celebrate the victory against the Philadelphia Phillies during Game Four of the National League Championship Series at Chase Field on October 20, 2023 in Phoenix, Arizona.  (Norm Hall/Getty Images)

"Huge contributions from everyone," Arizona outfielder Corbin Carroll said. "We knew we need it, being a bullpen game. Some huge hits today — almost too many to count. An unbelievable win."

Arizona, in the postseason for the first time since 2017, lost the first two games of the series at Citizens Bank Park. The Diamondbacks built a two-run lead against the defending NL champions on run-scoring singles by Rivera in the second and Moreno in the third.

Philadelphia Phillies player strikes out

Trea Turner #7 of the Philadelphia Phillies strikes out to end the game against the Arizona Diamondbacks during Game Four of the National League Championship Series at Chase Field on October 20, 2023 in Phoenix, Arizona.  (Sean M. Haffey/Getty Images)

The Phillies will turn to Zack Wheeler for Game 5, and likely Aaron Nola for Game 6. Meanwhile, Zac Gallen is scheduled to take the mound for the Diamondbacks in Arizona's final home game of the series.

CLICK HERE TO GET THE FOX NEWS APP

A crucial Game 5 is scheduled for 8:07 p.m. on Saturday.

The Associated Press contributed to this report.