PITTSBURGH -- A single strike from falling two games behind the Pittsburgh Pirates in the race for the top spot in the National League wild-card race, the Cincinnati Reds needed a break.
Jordy Mercer provided one. The surging Reds took care of the rest.
A wild throw by the Pittsburgh shortstop with two outs in the ninth inning opened the door for a three-run rally off Pirates closer Mark Melancon that tied the game. Joey Votto's home run off Kyle Farnsworth an inning later won it as the Reds pulled off an improbable 6-5 victory to move into a tie with the Pirates. Both teams are two games behind St. Louis for the lead in the NL Central.
More from ESPN.com
September baseball was at its best on Friday night, and a questionable managerial call cost the Pirates a crucial game vs. the Reds, writes Matt Meyers. SweetSpot
"That's really uncommon, really rare, and for us to have done that in a game like this, against this squad, against that pitcher, that makes it even more rare and pretty impressive," Votto said. "Guys just strung together a bunch of tough at-bats."
Ones that came after Mercer couldn't quite handle a slow grounder by Todd Frazier with one on and two outs in the ninth. Mercer charged the ball but couldn't get a grip on it and it ended up in the stands behind first base.
"If I make a good throw right there, the game is over and all the stuff that happened never happens," Mercer said. "It was tough. We played a great game, everybody played a great game and to have it happen like that, it's just a bad throw."
And the Pirates quickly unraveled.
Zack Cozart singled after Mercer's error to put runners on the corners. Cincinnati rookie base-stealing specialist Billy Hamilton pinch ran for Cozart and promptly swiped second then raced home when Devin Mesoraco ended a nine-pitch duel with Melancon by sending a sharp grounder that bounced off third baseman Pedro Alvarez and rolled onto the grass in shallow left field.
"I really just went up there and just thought about battling ..." Mesoraco said. "That was it. That was my only goal, just go up there, battle, battle, and hopefully leave one out over the plate that I could put a half-decent swing on and hopefully find a hole."
Melancon has been dominant since taking over the closer's role from Jason Grilli in July, but blew his second save in three days. San Diego rallied for a 3-2 win on Wednesday.
This one, however, will almost certainly be more difficult to overcome.
"That's a game we should have won and I think the Reds know that too," Melancon said.
JJ Hoover (5-5) earned the win for the Reds, who have won four straight. Aroldis Chapman worked the 10th for his 38th save.
"We hadn't come back in a long time, and we hadn't come back for a long time on the road," Cincinnati manager Dusty Baker said.
Pittsburgh began the week 74-2 when leading after eight innings, but has now squandered ninth-inning leads twice in three nights.
"Who said it was going to be easy?" manager Clint Hurdle said. "Who said it was going to be easy? We've been very good winning as a team, losing as a team ... we've got to find a way to finish things off."
The Pirates appeared firmly in control through eight innings.
Francisco Liriano overwhelmed the Reds, allowing two runs on three hits, walking three and striking out seven. The left-hander needed only 94 pitches to record 24 outs, but told Hurdle he was done when he entered the dugout after striking out Brandon Phillips to end the eighth.
"He was fantastic," Hurdle said. "He said when he came off he laid it all out there."
Ryan Ludwick finished 3 for 5 for the Reds, while Frazier hit his 17th home run.
Jose Tabata and Neil Walker hit consecutive homers off Cincinnati starter Mat Latos in the first and Pittsburgh appeared en route to giving itself some breathing room as the franchise pursues its first playoff spot since 1992.
PNC Park, typically a ghost town this time of year as the Pirates play out the string, was electric when Pittsburgh took the field. The 21st sellout of the season included Pennsylvania governor Tom Corbett and Pittsburgh Penguins coach Dan Bylsma.
Hurdle was ejected in the eighth for arguing after star Andrew McCutchen was hit by reliever Sam LeCure, who was given a warning by home plate umpire Mark Carlson ... The series continues on Saturday when Pittsburgh's A.J. Burnett (8-11, 3.43 ERA) faces Home Bailey (11-10, 3.40). Bailey tossed his first career no-hitter in his previous start at PNC Park last September.
37,940 (98.9% full) - % is based on regular season capacity
77 degrees, partly cloudy
Home Plate - Mark Carlson, First Base - Gerry Davis, Second Base - Dan Iassogna, Third Base - Brian Knight
From Elias: Friday was the second time in the last three games the Pirates lost after holding a lead entering the ninth inning; they were 74-2 when leading entering the ninth prior to that stretch.
The last time the Pirates lost after having a lead of 3 or more runs in the 9th inning or later was July 11, 2009 at the Phillies. They had won 163 consecutive games since then in that situation.
Billy Hamilton has scored 7 runs for the Reds this season and has made them all count.
* 5 of the 7 have been game-tying, go-ahead or game-winning runs
* 6 of the 7 have come in the 7th inning or later
* 3 of the 7 have come in extra innings
* 6 of the 7 have come after a stolen base
Billy Hamilton Runs Scored This Season
Sept. 3 Only run in 7th inning in a 1-0 win over Cardinals
Sept. 4 Game-tying run in 14th inning in 16-inning loss to Cardinals
Sept. 7 Game-winning run in 10th inning in walk-off win over Dodgers
Sept. 14 Final run in 8th inning of a 7-3 win over the Brewers
Sept. 18 Gave Reds 3-0 lead in 2nd inning
Sept. 18 Go-ahead run in 13th inning of 6-5 win over Astros
Sept. 20 Game-tying run in top of 9th inning vs Pirates