Instead, Pablo Sandoval and last-minute fill-in Mike Fontenot did the damage against Lilly and the Los Angeles Dodgers right after they took the lead.
Sandoval hit a tying solo home run in the sixth inning and Fontenot connected two batters later, lifting San Francisco to a 4-3 victory over Los Angeles on Wednesday night and a series win.
"It was upsetting," Lilly said. "You want to do everything you can to hold it there and two swings of the bat and we're behind, again."
Fontenot's two-out drive to the arcade in right-center off Lilly (0-2) just did it for winning pitcher Jonathan Sanchez, who struck out a season-best nine in six innings. Sanchez has 24 Ks over his first three starts.
Aaron Miles had a go-ahead RBI double in the top of the sixth among his three hits for his first multihit game of 2011, but the Dodgers' 3-2 lead didn't last long.
Sanchez (1-1) remained poised after allowing a two-run homer to Rod Barajas in the fourth that tied the game at 2.
It was Barajas' third homer of the year and second in this three-game series the Giants won.
Sanchez is 5-2 with a 1.64 ERA and 72 strikeouts dating to last Aug. 30. A 13-game winner in 2010, the 28-year-old lefty is also 3-1 with a 2.10 ERA and 38 strikeouts to only six walks over his past four outings against Los Angeles.
Closer Brian Wilson pitched a perfect ninth for the second straight night for his second save in three chances. Last year's majors saves leader with 48, Wilson struck out the side in a 5-4 win Tuesday. San Francisco (6-6) has played six one-run games already, going 4-2 — all four of the wins were come-from-behind victories on this homestand.
"We had a lot of those last year. They used the word torture," Fontenot said. "It's good to get some wins like that."
Sandoval — back to his slugging self after a rigorous offseason in which he dropped nearly 40 pounds — and Fontenot were the catalysts with their power on a day home run king Barry Bonds was convicted across town of obstruction of justice stemming from December 2003 testimony to a grand jury that he never knowingly took steroids or performance-enhancing drugs.
San Francisco took two of three in this series after the Dodgers won two of three when the teams opened the season.
This emotional series between the longtime rivals remained pretty tame after Monday's opener began with a joint on-field message of sportsmanship, respect and nonviolence by San Francisco's Jeremy Affeldt and Jamey Carroll of the Dodgers. Longtime Giants fan Bryan Stow was severely beaten outside Dodger Stadium on March 31 after the teams' season opener and is hospitalized in Los Angeles in a medically induced coma.
Lilly did generate a warning for both benches after he hit Posey for the second time in the third.
"You have to try and pitch him in and it was a cold night," manager Don Mattingly said.
"I think he's one of the better hitters in the league at hitting the ball over the plate and driving the ball the other way," Lilly said of Posey. "For the most part, I've got to stay hard in on his hands. I've missed out over the plate before and he's hit it pretty hard, so I think if I'm going to miss on him that's where I want to do it."
Posey didn't do any finger pointing but manager Bruce Bochy wasn't happy.
"You get your cleanup hitter hit twice, I don't think any club would like it, and we didn't," the skipper said.
Lilly was booed when he stepped into the batter's box to hit in the fourth. He allowed four runs on seven hits in six innings, struck out two and didn't walk a batter.
Casey Blake returned to Los Angeles' lineup after missing three games with a bruised thigh but played first base rather than his regular spot at third as manager Don Mattingly gave the struggling James Loney a night off.
Notes: Dodgers RHP Vicente Padilla, who underwent surgery on his pitching elbow Feb. 24, played catch on flat ground and is slated to throw off a mound Thursday or Friday. ... Andre Ethier singled in the seventh for the Dodgers, giving him a 10-game hitting streak.