The Braves overcame a 5-0 deficit with a five-run sixth inning, had three challenged calls at home plate go their way upon review, and even saw their troubled bullpen stand strong against the San Diego Padres.

They seriously needed a night like this, and Joey Terdoslavich topped it off in grand fashion with a leadoff pinch-hit homer in the eighth inning – the first homer of his career — to lift the Braves to a 6-5 win at Turner Field, just their second in seven games.

“I told Shelby (Miller) that it felt like the coolest thing that I’ve ever done,” said Terdoslavich, who still couldn’t stop smiling about a half-hour later. “It was great. We battled back, and it was awesome to be a part of, to get in there and contribute and be a part of grinding back to get back in the game and take the lead.”

In the top of the eighth, the Padres thought they had a 6-5 lead when former Brave Melvin Upton Jr. scored on Derek Norris’ fielder’s choice grounder to third baseman Juan Uribe. The Braves challenged the call, which was overturned when replays showed catcher Christian Bethancourt tag Upton as his foot stuck in the dirt just in front of the plate.

Leading off the bottom of the inning, reliever Joaquin Benoit threw a 95-mph fastball to Terdoslavich on a 2-0 count, and he lined it over the center-field fence for his first homer in 107 plate appearances spread over three seasons. What made it even more special: his dad and lifelong personal hitting coach, Joe, was at the game.

“I was texting with him afterward and he said, ‘You’re still shaking,’” said Terdoslavich, who spent the first two months of the season on the disabled list recovering from a wrist injury, and was only activated Friday.

After Upton led off the Padres’ eighth inning with a walk against reliever Jim Johnson, and advanced to third on a stolen base and Bethancourt’s throwing error, it looked like déjà vu for the beleaguered bullpen. But the reversed call and a good-enough ninth inning for closer Jason Grilli gave the Braves and the ‘pen a reprieve.

Grilli gave up a 1-out double to Yonder Alonso in the ninth before getting a pop-up for the second out. After Alonso advanced to third on a wild pitch and a walk put runners on the corners, Grilli struck out Clint Barmes for his 16th save, one night after he got his second blown save in an 11-inning loss to the Padres to open the four-game series.

“They don’t give up,” said manager Fredi Gonzalez, whose Braves closed to within 2 1/2 games of National League East leader New York and two games of second-place Washington. “For them to come back against tough pitcher in Shields, that was nice…. Obviously we took very good advantage of the replays, and that’s what it’s there for. Our bullpen did a nice job, coming out with all those guys there and did a nice job.

“Nice play at the plate with Uribe, who cut Melvin down with the potential winning run. A lot of good stuff happened today, but I love that our team fights. They don’t give up.”

Reduced to a footnote was the second bad start in a row for Braves rookie Mike Foltynewicz, who gave up a career-high 12 hits and five runs and failed to make it out of the sixth inning. “Folty” has allowed 20 hits and 10 runs (nine earned) in 11 ½ innings over his past two starts, failing to make it out of the sixth inning of either.

“There were a lot of two-strike pitches that I didn’t get where I wanted, missed a lot of them,” Foltynewicz said. “There were 12 hits out there, and probably half of them with two strikes. So we’ve just got to get better locating them, locating that off-speed better. The bullpen and offense saved my butt tonight, so it was a great win.”

The Braves fell behind 5-0 against Padres ace James Shields. But after David Aardsma replaced Foltynewicz and got Justin Upton to pop up for the last out of the sixth with a runner on second in Aardsma’s Braves debut, the Braves offense got Foltynewicz off the hook by scoring five runs in the bottom of the inning to tie.

Jace Peterson led off with double, the fourth base runner allowed by Shields and the first extra-base hit. One out later, Freddie Freeman singled to put runners on the corners, and Nick Markakis (3-for-4) hit a ground ball that was booted by second baseman Cory Spangenberg, with Peterson scoring on the play and Markakis credited with an RBI.

The Padres still led 5-1, but the Braves had two on and only one out with the veteran Uribe up. A wild pitch advanced both runners, and Uribe walked to load the bases for Simmons, who pulled a sharp double over third base and down the line. Two runs scored easily and Uribe raced around the bases and slid wide of catcher Norris, reaching for the plate.

Uribe was called out, but the Braves challenged. The call was overturned upon review, the crowd roaring in jubilation when the umpire signaled safe. Jonny Gomes followed with an RBI single through the right side that scored Simmons from second base with the tying run, and this time it was the Padres challenging the safe call at the plate.

That play, too, was reviewed and the call was upheld. The Braves had tied the score with five runs in the inning.

Shields gave up seven hits and five runs (four earned) in 5 1/3 innings, with one walk and six strikeouts. He entered with a solid if unspectacular 3.58 ERA, but his run support – 7.17 runs per nine innings pitched – was the best among National League starters and a boost to his 7-0 record.

The Padres supported him Tuesday with single runs in the second, third and fifth innings, then two in the sixth to chase Foltynewicz.

Foltynewicz blew all but one run of a 6-0 second-inning lead at Arizona on Wednesday and came away with no decision in a 9-8 Braves loss.

Against the Padres, the rookie gave up leadoff hits in three of the first five innings, including a Venable homer in the third. But Foltynewicz’s biggest mistake was arguably a pitch that Shields hit for a two-out single in the sixth. Venable and Norris followed with RBI doubles that pushed the Padres’ lead to 5-0 and chased Foltynewicz from the game.