Andrew Cashner allowed two runs over eight innings and relievers Joe Thatcher and Luke Gregerson struck out the side in the ninth Tuesday night to lead the Padres to a 3-2 win over Atlanta before 22,330 at Petco Park.

But the Padres suffered another major loss when it was announced that center fielder Cameron Maybin will miss six to 10 weeks with a torn posterior cruciate ligament in his right knee.

Maybin suffered the injury diving for a ball Sunday in Denver in his fourth game back after missing 45 games with an impingement and inflammation in his right wrist.

The Padres second straight win over the National League East-leading Braves moved the hosts to within three games of .500 for the first time since June 1.

A first-inning homer by Chase Headley and run-scoring hits by Nick Hundley and Carlos Quentin gave the Padres their first win ever against Atlanta’s 201-game winner Tim Hudson.

Cashner gave up six hits and issued one walk while throwing 107 pitches. The outing was the longest of Cashner’s career. He went 7 1/3 innings twice earlier this season.

“It was a great game by Cashner,” said Padres manager Bud Black. “Not only the performance, but the effort to pitch eight innings. It saved a few guys in the pen from having to warm up.”

All the Braves hits were clustered in the first and sixth innings, which is when they scored their runs.

The Braves struck first with a run in the top of the first on a lead-off single by Andrelton Simmons, a wild pitch by Cashner and a two-out single by first baseman Freddie Freeman. Brian McCann followed with a single but Cashner ended the rally by getting Dan Uggla to pop out to Headley.