PITTSBURGH—When starting pitcher Williams Perez had his good night ended by a bad bounce, the Braves could have gone down quietly and chalked it up to tough luck.

Instead, the Braves came back to tie the game on Juan Uribe’s home run in the sixth inning and pushed the Pirates to extra innings. But Pirates shortstop Jordy Mercer’s RBI double against closer Jason Grilli sent the Pirates to a 3-2 victory on Friday.

Andrew McCutchen led off with a ground-rule double against Grill in the 10th. After an intentional walk to Starling Marte, Grilli struck out Pedro Alvarez before Mercer doubled off the right-field wall to send the Braves to their fourth consecutive defeat.

It’s only 320 feet to the right-field corner at PNC Park. Grilli knows its challenges better than most because he pitched for the Pirates from 2011-2014, but he brushed off the park’s geometry as a factor.

“You can’t play the maybes and what-ifs,” Grilli said. “That’s not my approach. I go at people. Tonight (is) no different than any other. You’ve got to sometimes tip your cap to the (other) guys who are doing their job, too.”

Perez was forced to leave the game when he was hit in the foot by a ground ball in the fifth inning. Pedro Alvarez hit a go-ahead two-run single off of relief pitcher Luis Avilan before Uribe homered.

Gonzalez said x-rays were negative on Perez’s foot. He is to be reevaluated once the swelling subsides.

“When I first got hit I thought it was a lot more serious,” Perez said through an interpreter. “ I thought maybe I broke my foot. But thank God it wasn’t that serious and hopefully I will be out there (again) soon.”

The Braves could only scratch out two runs against Pirates starter Francisco Liriano. They scored a total of two runs while losing all three games at the Nationals and have scored 15 in the eight games since first baseman Freddie Freeman (wrist) left the lineup.

Perez was staked to a 1-0 lead when Francisco Liriano walked Ryan Lavarnway with the bases loaded in the second inning. Perez allowed just four hits and no runs through four innings before the injury got him off track in the fifth.

Perez retired Liriano for the first out in the fifth. The next batter, Josh Harrison, hit a sharp ground ball off Perez’s left foot as he followed through on the pitch.

The ball bounced off of Perez to first baseman Chris Johnson for the out, but Perez went to the ground and stayed there for several moments. Perez eventually got up and tested the ankle with some warm-up pitches before staying in the game.

Perez walked the next batter, Neil Walker, on four pitches. He fell behind 2-0 to McCutchen before hitting him with a pitch in the back.

Perez said he told Gonzalez and team trainers he was fine to stay in the game but the foot swelled up as he faced Walker and McCutchen.

“After I got hit I was a little scared, a little timid to get on the foot,” Perez said. “That caused me to be a little more erratic.”

Braves manager Fredi Gonzalez summoned left-hander Luis Avilan from the bullpen. Starling Marte was called out at first on a throw by second baseman Jace Peterson but the call was overturned after a replay review.

Pedro Alvarez followed with a broken-bat, two-run single to give the Pirates a 2-1 lead. Both runs were charged to Perez.

The Braves couldn’t solve Liriano through five innings. He lost his control to walk home the run in the second inning but got double plays to end the first and third innings and for the first two outs in the fourth.

Uribe finally got to Liriano with the tying home run in the top of the sixth. He smashed Liriano’s 1-1 pitch over the wall in straightaway center field for his fourth homer of the season.

Before his injury, Perez had matched Liriano.

“He was pitching well,” Gonzalez said. “He had that sinker going and they were beating it into the ground.”

Mercer knocked a two-out double in the second inning but Perez struck out the next hitter, Gregory Polanco. Harrison singled with two outs in the third inning and Perez hit Walker with a pitch before McCutchen popped out in foul ground.

The Pirates loaded the bases against Perez with two outs in the fourth inning but the rally ended because of a base-running blunder by Polanco.

With runners at first and second, catcher Chris Stewart hit a ground ball that shortstop Andrelton Simmons kept in the infield with a diving stop. He threw late to first base and Stewart was on with a single.

But as Simmons made the throw, Polanco ran from second to third base, where teammate Jordy Mercer was standing. Second baseman Jace Peterson tagged out Polanco to end the inning.