After Mike Foltynewicz blew a 3-1 lead and gave up a tying homer to Asdrubal Cabrera to start the fourth inning, the Braves rookie struck out four of the next five batters. Now he was cooking with gas.

But just as quickly as he’d gotten into a groove against the Rays, young “Folty” bounced back out of it and was on the way to his first loss as a major league starter. Tampa Bay won 5-3 Tuesday night.

The Braves prospect walked James Loney on five pitches with two out in the fifth, threw a wild pitch and got behind in the count 3-0 before giving up a go-ahead single to Logan Forsythe. The Foltynewicz got ahead in the count 0-2 against David DeJesus before giving up an RBI double on a fastball over the plate.

A two-run lead had turned into a two-run deficit for the Braves in a three-inning span, and they lost the opener of a two-game set and a six-game homestand at Turner Field to snap their three-game winning streak.

“You’re going to live through some growing pains,” Braves manager Fredi Gonzalez said “It’s a 3-3 game in the fifth inning, he strikes out the first two, loses his concentration or focus, walks the next guy, wild-pitches a guy to second. Next thing you know it’s a double and he’s in line for the loss and gives up two runs.

“Those are the growing pains you’re going to have to live with with a young pitcher.”

Rays right-hander Erasmo Ramirez (2-1) limited them to two hits, three runs and two walks in five innings in his fourth start of the season. All the Braves’ runs came in the second, and they didn’t send more than four batters to the plate in any other inning and finished with just four hits.

“(Ramirez) made some good pitches,” said Braves leadoff hitter Jace Peterson. “I thought Folty threw pretty good, we just didn’t get it done tonight. But that’s the thing about baseball, we get to come back and get them tomorrow.”

Foltynewicz (2-1) lasted five innings and gave up eight hits and five runs with one walk and seven strikeouts. It was more hits and more runs than he had allowed in any of his 19 previous outings, including three starts this season and 16 relief appearances with the Astros.

The rangy right-hander has struck out seven in each of his past three starts, but allowed 21 hits (three homers) in 17 innings in that span. Eight of 15 runs he’s allowed in four starts have come in the last inning he pitched.

“I think I was trying to overdo a little too much there in the later innings, trying to throw a little harder and make my pitches break more,” Foltynewicz said. “That walk and that wild pitch led to the run there. I think I was trying to do too much in the later innings. I’ve just got to keep within myself the next time and go out there and pitch.”

After sweeping three games from the Marlins in Miami in a series that ended Sunday, the Braves seemed poised to extend a three-game streak Tuesday after taking a 3-1 lead in the second inning.

They loaded the bases with none out when Nick Markakis walked, hot-hitting Todd Cunningham doubled and A.J. Pierzynski was hit by a pitch. Andrelton Simmons worked an eight-pitch walk to bring in the tying run, Cameron Maybin punched a single through the right side for a 2-1 lead, and Peterson’s one-out groundout drove in the third run.

The Rays set about chipping away at the lead, getting a run in the third inning on consecutive singles by Steven Souza and Evan Longoria, with a Souza stolen base putting him in scoring position.