PHOENIX (AP) -- The Arizona Diamondbacks are back to their come-from-behind tricks.
Ryan Roberts and Lyle Overbay hit consecutive two-out homers off Matt Cain and the Diamondbacks tied a franchise record by rallying from six runs down to beat the San Francisco Giants 7-6 Sunday and sweep the season-opening three-game series.
"That one will make you smile, it really does," Arizona manager Kirk Gibson said. "I think it brings back good memories for us."
It marked the seventh time in franchise history that Arizona came from six down to win. The Diamondbacks did it twice last year, when they led the majors with 48 come-from-behind wins.
"It's nice," Overbay said. "To do it against Matt Cain and the Giants, that's a tough task."
Giants manager Bruce Bochy was ejected for arguing home plate umpire Mike DiMuro's call that catcher Buster Posey missed the plate on a forceout, a ruling that allowed what proved to be the winning run to score in the seventh inning. Bochy said after the game that he was wrong.
"I couldn't tell to be honest. I argued, then came back and got word that he was on home plate," Bochy said. "That is when I lost it. Looking at it, he got it right. Buster was not on home plate."
Posey said he didn't know.
"I couldn't feel the plate," he said. "I couldn't tell. As hard as the ground is there, I couldn't feel."
Posey hit his first home run in nearly a year to help the Giants take a 6-0 lead through three innings.
Wade Miley (1-0) pitched four scoreless innings in relief of starter Josh Collmenter to get the win. Jeremy Affeldt (0-1) allowed two runs while getting just one out.
In the ninth, Bryan Shaw allowed a two-out single to Melky Cabrera and hit Pablo Sandoval with a pitch but fanned Posey on three pitches to get his first major league save.
"They chipped away and we couldn't add on," Bochy said, "and in the one inning what could go wrong did go wrong. We couldn't make a play there and a couple of walks mixed in. We beat ourselves."
The Diamondbacks won all three games by one run to extend their winning streak over the Giants to eight games.
Overbay also doubled twice, driving in a run with the first.
There were eight errors in the game, five by Arizona, one shy of the club record.
"I've said several times I love playing ugly games and winning them," Gibson said. "Today's game was really beautiful but we didn't play very well."
Down 6-5, Arizona loaded the bases with one out in the seventh and tied it when shortstop Brandon Crawford couldn't handle Miguel Montero 's sharp grounder for what should have been a double play. Chris Young then hit a bouncer to third, where Sandoval fielded it and threw to Posey. What appeared to be a routine out instead turned out to be the go-ahead run when DiMuro called the runner Aaron Hill safe.
"The umpires are trying just like we are to make calls," Gibson said. "I have no idea what he was but he called him safe and I was diggin' it."
Posey, the 2010 NL rookie of the year who was out for the season after a home-plate collision May 25, hit a two-run homer in the Giant's three-run third inning. It was his first home run since last April 24.
San Francisco scored three in the second when Posey led off with a single off Collmenter, then Aubrey Huff walked. Crawford doubled down the left field line to bring home Posey, and Huff scored when left fielder Gerardo Parra bobbled the ball. Crawford advanced to third on Parra's throw home and scored when Emmanuel Burris bounced out to short. Parra committed only three errors all of last season, earning a Gold Glove.
With Arizona runners on first and second and one out in the fourth, the center fielder Blanco robbed Roberts with a charging, diving grab of his pop fly. But Overbay followed with a double to the right field corner to bring both runners home and make it 6-2.
Cain's final inning was the sixth, when with two outs Roberts hit a two-run homer into the left field seats. On the next pitch, Overbay launched one onto the porch above the pool deck in right-center to slice the lead to 6-5.
Cain, in his first game since signing a six-year, $126.5 million contract, gave up five runs on six hits, striking out four and walking two. Collmenter, who was lifted for a pinch hitter in the fourth, allowed six runs - five earned - on five hits. He struck out four and walked one.
NOTES: The Diamondbacks have Monday off then open a three-game series at San Diego on Tuesday, with ex-Oakland right-hander Trevor Cahill making his Arizona debut. ... San Francisco begins a three-game set in Colorado on Monday, sending Barry Zito to the mound against Jhoulys Chacin in the Rockies' home opener. ... Arizona did not commit an error in the first two games of the series.