The San Diego Padres were one strike away from padding their lead atop the NL wild-card standings.
The Detroit Tigers' Parker Meadows changed that with one swing of the bat.
Down 3-0 with two outs and two strikes in the top of the ninth inning, Meadows hit a grand slam to stun the Padres and send the Tigers to a thrilling 4-3 win on Thursday.
Parker hit a 101 mph four-seam fastball off Robert Suarez that travelled 361 feet and landed just over the short left-field fence in San Diego.
San Diego (80-62) lost for the first time in four games and its lead over the Arizona Diamondbacks shrunk to just one-half game for the NL's top wild-card spot.
Jurickson Profar and Xander Bogaerts each homered for the Padres, who end the regular season with a three-game series at Arizona.
Meadows' homer was just his sixth of the season and lifted the Tigers (71-70) back over .500 and within five games of the Royals for the AL's final wild-card spot.
Braves lose, now tied for final NL wild card spot
The Atlanta Braves suffered a 3-1 loss to the last-place Colorado Rockies to drop into a tie for the league's final wild-card berth with the idle New York Mets.
Atlanta and New York have identical 76-64 records with 22 games remaining.
The Braves, who got their lone run on Ramón Laureano's RBI single in the first inning, managed just five hits with Orlando Arcia's second inning-double the only one going for extra bases in the finale with the Rockies (52-89).
Colorado's Michael Toglia and Ezequiel Tovar each hit solo homers off Atlanta starting pitcher Reynaldo Lopez, who gave up three other hits while striking out 11 without a walk in his six innings of work.
Rockies starter Austin Gomber went eight innings, yielding a run and five hits without issuing a walk while striking out six.
Phillies push winning streak to five
The Philadelphia Phillies beat the Miami Marlins 5-2 to extend their winning streak to five games and increase their lead atop the NL East to eight games.
Bryson Stott hit an RBI single in the first inning and a long solo homer during Philadelphia's four-run sixth inning.
Kody Clemens knocked in a pair of runs with a double in the sixth and later came around to score on a wild pitch.
Ranger Suarez gave up three hits over five scoreless innings for the Phillies (84-56), who have won 10 of 12.
The Marlins (52-88) scored their first run in the seventh on an RBI single by Jesús Sánchez and plated their final run an inning later on a throwing error by Clemens.