SAN FRANCISCO -- Jeff Salazar stood by his locker on a puffy, purple ankle as Arizona boss Jeff Moorad reached out his hand.
"Congratulations. Outstanding," said Moorad, the Diamondbacks' general partner.
Salazar was a late lineup scratch because of his bum left ankle, then came up big with a go-ahead, three-run homer in the ninth inning of the D-Backs' 5-3 victory over the San Francisco Giants on Monday night.
"Luckily it caught the barrel," said Salazar, a late scratch from the lineup before the game. "As hard as it is to hit a home run here, I'm still surprised it got out there."
Both of Salazar's two career homers came as a pinch-hitter against the Giants, with the last one on Sept. 18, 2006, while with the Colorado Rockies.
Salazar hit a 2-0 pitch from Brad Hennessey (3-5) into the arcade in right-center and the D-Backs pulled off yet another of their incredible comeback wins. Their sixth straight victory increased their NL West lead to 3½ games over the idle San Diego Padres.
Arizona swept the defending World Series champion St. Louis Cardinals over the weekend by a combined four runs -- including two one-run victories.
"The way it's gone of late, as many close games as we've played and as the games with the Cardinals would suggest, as long as we still have at-bats left we still have a chance," D-Backs' manager Bob Melvin said. "Until the final out, we have a chance."
Bengie Molina hit a pair of solo home runs for San Francisco. He homered leading off the second and again to start the fourth, both on 0-1 pitches from former Giant Livan Hernandez. Molina has a career-high 79 RBI -- 76 of them as a catcher, second-most in San Francisco history. Dick Dietz had 104 in 1970.
Molina's 19 home runs match his career high, which he also did last season with the Toronto Blue Jays. It was his third career multihomer game and second this year. He also hit two in a home game May 7 against the New York Mets.
Giants starter Tim Lincecum allowed six hits and two runs in 6 2/3 innings, struck out three and walked three -- one intentional. The hard-throwing right-hander threw 10 of 11 strikes to start the game but saw his winless stretch reach four starts. He has only one victory in eight starts since beating Atlanta on July 26.
He left to a standing ovation when replaced by Tyler Walker with two outs in the seventh, after Emilio Bonifacio's second RBI single of the game cut San Francisco's lead to 3-2. Bonifacio was caught stealing for the third out.
"He made some great pitches after the double," manager Bruce Bochy said. "The walk killed us, and then he got a ball up. They've won a lot of games like that, and that's why they're where they are. They got the timely hits and scored all their runs with two outs."
Hernandez allowed his majors-leading 31st home run of the year, passing Houston's Woody Williams and Minnesota's Johan Santana at 30. Hernandez joined Greg Maddux and Tom Glavine as the only active pitchers to make 30 or more starts in each of the last nine seasons.
Barry Bonds -- the home run king with 762 homers -- went 1-for-3 with a single and his 130th walk.
Arizona has beaten the Giants six times by one run this season, and this time by two. The D-Backs are 2-5 in San Francisco's waterfront ballpark.
Bonifacio made his first major league start, playing second base on the day All-Star second baseman Orlando Hudson underwent season-ending surgery to repair a torn ligament in his left thumb. Bonifacio had his first big league hit and RBI with a single in the fifth to put Arizona on the board -- and he earned another start Tuesday night.
"I couldn't stop smiling," he said. "I got two RBI. That was a good feeling. I was so excited. I was just trying to play my game and get on base."
After consecutive one-out walks in the second, Miguel Montero singled off the wall in center before being caught in an unusual rundown that went 8-4-2-5 -- from center fielder Dave Roberts to second baseman Frandsen, to catcher to third baseman Rich Aurilia, who made the tag right off first base.
Drew might have scored on the play but waited to see if Roberts would catch it. Mark Reynolds held up at second and Montero caught up to him. Melvin sighed in the dugout afterward.
San Francisco grounded into double plays in the second, third and sixth innings.
- Roberts stole his 29th base in the first. Bonds is the last Giant to steal 30 bases, when he had 37 in 1997.
- Hudson's 2-hour procedure was performed by hand specialist Don Sheridan in Phoenix, and the All-Star was resting comfortably back in the desert.
- A sparse crowd of 33,498 attended the game on a night when the San Francisco 49ers opened their season against the Arizona Cardinals across town at Candlestick Park.