SAN DIEGO – When last the Braves beat the Padres at Petco Park, Kris Medlen was Atlanta’s starting pitcher, Chipper Jones and Dan Uggla drove in the game’s only two runs, and Julio Teheran was a prospect in Triple-A, having been up and down a few times with the big-league team.

Nearly 46 months later, the Braves finally won again at the ballpark in San Diego’s historic Gaslamp Quarter.

Teheran pitched eight strong innings Wednesday in a 4-2 win as the Braves avoided being swept in a three-game series and six-game southern California trip. They stopped losing streaks of six games overall, six games on the road and six against the Padres, as well as a 12-game skid at Petco since late-August 2012.

“To say (Teheran) came up big is probably an understatement,” said interim manager Brian Snitker, whose Braves played a man short after trading Kelly Johnson to the Mets early Wednesday. “Where we were today, bullpen-wise, position player-wise after the trade … it couldn’t have come at a better time.”

Ender Inciarte and Chase d’Arnaud had three hits apiece from the first spots in batting order, Inciarte with a single, double and triple. Each singled in the first inning before Freddie Freeman’s sacrifice fly, which was followed by two more singles from Jeff Francoeur and Nick Markakis to push the lead to 2-0.

“(Inciarte) and d’Arnaud created a lot of havoc today at the top of the lineup, and that’s what we need to get some wins,” Freeman said. “Seemed like they were always on base and we were able to get them in a few times today. It makes the flight a lot easier going back home, getting a win. It’s been a long time since we got a win here in San Diego. We’ve got a tough weekend, tough matchups (against the Cubs), so hopefully we can carry this hitting into this weekend.”

Freeman added a double and his second opposite-field near-homer in as many games for the Braves, who went 1-5 against the Dodgers and Padres on the trip. They’re off Thursday before hosting the powerful Cubs to start a seven-game homestand at Turner Field.

Teheran (2-6) allowed two runs, five hits and one walk with eight strikeouts in eight innings and 110 pitches, the only damage on a pair of Wil Myers home runs. Teheran also had two hits himself.

He gave up five solo home runs in two starts on the trip but Teheran allowed only three other hits and no other runs.

After surrendering three runs and being pulled after 5 2/3 innings of a 4-2 loss to the Dodgers, Teheran had no trouble with anyone in the Padres lineup except Myers, who had his fourth multi-homer game and first since 2014.

“Today we really, really needed (Teheran),” Snitker said, “and it was almost like I remember back in the day — it was a ‘give me a couple of runs and I’ll take you for a ride’ type thing.”

The Braves had four hits and a 2-0 lead before Padres left-hander Drew Pomeranz (5-6) recorded his second out. Pomeranz was 3-1 with a 0.73 ERA in four home starts before Wednesday, when he gave up nine hits and three runs in five innings.

It was the fourth consecutive game in which the Braves took a first-inning lead, but the first time their starting pitcher didn’t give the lead back in the bottom of the first. Teheran didn’t allow a hit until Myers’ leadoff homer in the fourth inning, which cut the Braves’ lead to 3-1.

“Whenever we got the lead that’s a good thing for the starting pitching,” Teheran said. “We just try to hold the other team then, and I was able to do it. I know the two homers, but I was just trying to concentrate and keep my team in the game, and that’s what I was able to do.”

Inciarte tripled and scored on d’Arnaud’s double in the sixth to push the lead back to three runs before Myers hit his second homer.

Ex-Brave Melvin Upton Jr. made a leaping catch in front of the left-field wall to rob Freeman of a fifth-inning homer, the second potential homer Freeman lost in that area in 15 hours. His eighth-inning fly ball caromed off the top of the fence and back to the field for a triple in Tuesday’s 4-3 loss.

“I asked (Upton) if it was going to be home run and he said yes,” Freeman said, smiling. “I said, why didn’t you just tell me it was going to be a double instead of a home run. But I hit it too high, gave him time to get back there.”

Teheran has allowed 20 homers in his past 21 starts, but has a 2.98 ERA in that period. He won for just the fifth time in those 21 games as the Braves scored more than two runs while he was in the game for just the fifth time in that span.