Devin Mesoraco tied the game with a two-run infield single in the ninth inning, and Joey Votto homered in the 10th to boost the Cincinnati Reds to an improbable 6-5 victory over the Pittsburgh Pirates.
The opener of the three-game set between the teams holding the NL's two wild card spots was nearly decided in the ninth, but the Pirates' Mark Melancon failed to hold a 5-2 lead.
Votto sliced a ball barely over the wall in left off Kyle Farnsworth (1-1) with one out in the 10th, and the Reds posted their fourth straight win to forge a tie with the Pirates atop the wild card standings. Both teams are two games behind St. Louis in the NL Central.
"It's really uncommon," Votto said of the comeback. "It's a rarity. For us to have done that in a game like this, against this squad, against that pitcher makes it even more rare. It's pretty impressive."
Ryan Ludwick singled for Cincinnati in the ninth, and Todd Frazier grounded a ball to a charging Jordy Mercer with two outs, but the shortstop threw high to first to score Votto and get the Reds within two runs. Zack Cozart then singled to right field, and pinch-runner Billy Hamilton stole second.
Next up was Mesoraco, who capped a nine-pitch at-bat by hitting a bouncer to a scrambling Pedro Alvarez at third. The ball bounced off his glove toward shortstop as Frazier and Hamilton dashed home.
Pinch-hitter Xavier Paul then singled to left off Tony Watson, and the Reds nearly went ahead when Shin-Soo Choo hit a comebacker that caromed off Watson. The pitcher recovered, however, and threw out a diving Choo at first.
J.J. Hoover (5-5) pitched the bottom of the ninth and Aroldis Chapman retired the side in order in the 10th for his 38th save.
The Pirates were cruising behind Francisco Liriano's sparkling final home start of the regular season. The lefty, who has lost just once at PNC Park this year, allowed three hits and two runs and had seven strikeouts over eight frames.
"We should have won that game. That was our game to win," Melancon said.
Mat Latos, who gave up only one homer over his previous 10 starts, surrendered two over his first four pitches of Friday's game, with Jose Tabata and Neil Walker both connecting. Latos was charged with four runs on eight hits over six frames.
Tabata drove in two runs for the Pirates, who play five of their remaining eight games against the Reds. Pittsburgh, which hasn't made the playoffs since 1992, has lost four of its last five games.
Ludwick's single to left-center plated Brandon Phillips in the top of the first, but the home crowd of 37,940 had plenty to cheer about in the bottom portion when Tabata lined Latos' third pitch over the wall in left. Walker hit the next to center for his 12th homer of the year.
Liriano retired 10 consecutive batters until Frazier led off the fifth with a solo blast to center.
In between that time, the Pirates came up with two runs in the fourth, thanks to RBI base hits from Russell Martin and Mercer, to take a 4-1 lead.
Mercer singled in the seventh, moved to second on Liriano's sacrifice bunt and scored on Tabata's bouncer into center field for a 5-2 advantage.
Both managers had shouting matches with umpires in the bottom of the eighth inning, when the Reds' Sam LeCure pegged Andrew McCutchen on the left arm. Only Pirates skipper Clint Hurdle was ejected, however.
In his 11 starts at PNC Park this season, Liriano went 8-1 with a 1.47 ERA. He also raised his career strikeout total to 1,001 ... The Pirates' pitching staff has piled up 1,195 strikeouts this year, which is a new team record, topping the 1,192 from 2012 ... Ludwick had three of Cincinnati's nine hits ... Hamilton is 10-for-10 in stolen base attempts ... This is Pittsburgh's first loss when leading by three or more runs entering the ninth inning since 2009. The Pirates had won 163 straight in those situations.