"It's been a long, fun journey and I appreciate everything that's happened," Ankiel said.

Farnsworth and Ankiel came to the Braves at the trade deadline from Kansas City.

"The two guys we got in the trade won us the game tonight," catcher Brian McCann said. "This was the best win I've ever been a part of. You don't want to be down 0-2 in a best-of-five series. That was huge. I'm in awe of what we just did."

Atlanta earned 46 come-from-behind victories this season and did it again when it mattered most. This is the only first-round playoff series that is even after two games.

"It just seems like our resiliency has paid off for us all season, and it's been fun to be a part of," Ankiel said.

Alex Gonzalez hit a tying, two-run double in the eighth against Giants closer Brian Wilson, who led the majors with 48 saves this season.

Ankiel's drive on a 2-2 pitch from Ramon Ramirez was just the second splash homer in the postseason at 11-year-old AT&T Park. Home run king Barry Bonds hit the other one on Oct. 10, 2002, in Game 2 of the NL championship series against St. Louis.

Posey grounded into 5-4-3 double play in the 10th, keeping the score tied at 4.

Wagner, who plans to retire after the season, first grabbed at his left side after chasing pinch-hitter Edgar Renteria's bunt single to start the inning. The left-hander then fielded Andres Torres' sacrifice bunt back to the mound, threw to first for the out and immediately grabbed at the area near his left hip before crumbling to his knees.

The 39-year-old Wagner walked slowly off the field with a trainer and was replaced by Farnsworth, who was given all the time he needed to warm up.

"I don't know how I'll feel tomorrow. I know it's pretty sore now," Wagner said.

Farnsworth hit Freddy Sanchez in the right hand on his third pitch. Sanchez went down writhing in pain and was quickly examined, but went to first base.

Wilson entered with runners at the corners and none out in the eighth after Sergio Romo gave up back-to-back singles to Derrek Lee and McCann.

Melky Cabrera hit a slow roller toward third that scored Atlanta's second run. Pablo Sandoval's throw to first pulled Aubrey Huff off the bag for an error, but Cabrera looked as though he would have beaten the throw anyway.

Gonzalez tied it two batters later with a double to left-center.

Wilson was trying for his first career six-out save. He pitched two innings twice during the regular season. The All-Star closer had gone 26 consecutive appearances without allowing more than one earned run until Friday.

"When I'm called upon, I enjoy being the stopper. When the skipper asks me to come out, regardless of the situation, I feel like I should be able to get out of it," Wilson said. "It's already past me. The game's over. I can't really focus on that."

Atlanta's rally spoiled a strong postseason debut by Giants starter Matt Cain a day after Tim Lincecum's 14-strikeout, two-hit gem in a 1-0 victory. Pat Burrell hit a three-run homer in the first inning to stake San Francisco to a quick cushion.

Burrell connected on the first pitch from Tommy Hanson with two outs in the first, sending the pompom-waving sellout crowd of 44,046 into a frenzy of orange. The attendance was the largest in the history of AT&T Park, topping the total from the 2007 All-Star game.

But Ankiel's shot silenced the ballpark, and he was pelted with a celebratory cream pie after the game.

"It's a tough loss, no getting around it," Giants manager Bruce Bochy said. "You have to bounce back. They fought hard. We had a couple of chances to add on, but their 'pen shut us down."

The Braves, back in the playoffs for the first time since 2005, had a major league-leading 25 wins in their final at-bat this year.

The teams have Saturday off for travel. Left-hander Jonathan Sanchez goes in Game 3 for the Giants against righty Tim Hudson. Both pitched their teams to victory and playoff berths on the final day of the regular season.

McCann's RBI single in the sixth snapped a 24-inning postseason scoreless stretch by the Braves dating to their last trip to the playoffs.

The Giants hadn't allowed a run in 28 innings since the fourth inning of their game last Saturday against San Diego.

Cox got tossed by umpire Paul Emmel in the second after Gonzalez was called out at first on a close play. Emmel was the umpire at second base in Game 1 who called Posey safe on a stolen base when replays showed he was out. Posey later scored the only run of the game.

The 69-year-old Cox, who is retiring after the season, did not argue in the opener -- but he did this time. He was ejected by Emmel immediately after throwing his hat to the ground.

Game notes

Cain went 11-0 in 18 starts when receiving three runs of support this season. ... Cox has been ejected from a record 158 regular-season games. ... Ankiel's shot was the 18th go-ahead homer of his career.