Miami's nine-game winning streak at San Francisco was snapped when Sanchez's single dropped in front of Justin Ruggiano in left.
The Marlins watched the Giants celebrate on a day Miami left nine runners on base and were hitless in five at-bats with runners in scoring position.
In the series finale Sunday, the Marlins still have a chance to take three of four.
"Any time you have a chance to win three against these guys at their park, you want to be able to take advantage of it, for sure," Ruggiano said.
Gregor Blanco reached on an infield single off Ryan Webb to open the 11th. A sacrifice bunt by Marco Scutaro moved Blanco to second and he took third on Buster Posey's infield single up the middle. Hunter Pence was intentionally walked to load the bases for Sanchez.
"I didn't have a play," Ruggiano said of Sanchez's single. "If I had dove for the ball, there is no play on that. My only chance was to get it on a clean hop, which was tough because it was spinning sideways, and try to throw the guy out."
The game featured Mike Redmond's first ejection as Miami's manager and two squandered chances in extra innings.
The Marlins threatened in the 10th inning. Placido Polanco singled off Sergio Romo, and Greg Dobbs slapped a pinch-hit single off Javier Lopez. But Sandy Rosario entered and struck out Ruggiano and Ed Lucas.
In the 11th inning, Rosario worked out of a first-and-second, one-out jam when Polanco's sinking liner to right field was caught by Pence, who made a diving grab. Marcell Ozuna, who doubled, was primed to score the go-ahead run.
While they didn't deliver the big hit, the Marlins didn't have much luck either. Polanco was robbed of his fourth hit when Pence made his catch. And Ruggiano, during his at-bat in the 10th inning, ripped a grounder just foul down the third-base line. He ended up striking out.
Pence's sprawled-out catch swung momentum to the Giants, who avoided dropping three straight to Miami.
"I knew it would be close," Giants manager Bruce Bochy said of Pence's effort. "It was a great catch that saved the game for us."
The Marlins have shown improvement, sporting a 10-9 record in June. But their overall record fell to 24-50. Generating runs has been a struggle all season, and the pattern continued as they fell to 11-15 in one-run games.
"It seems like the same story every day," Redmond said. "We pitch great and we just have a tough time scoring runs."
Both starting pitchers were effective over seven innings.
Jacob Turner, making his fifth start, impressed by giving up one run on six hits, lowering his ERA to 1.97. But he wasn't involved in the decision.
San Francisco's Barry Zito gave up one run, a home run to Lucas, over seven innings with five strikeouts.
In many ways, it's been a series of firsts for the Marlins at AT&T Park. On Saturday, it was Lucas' turn. The 31-year-old rookie connected on his first big league home run, when he went deep off Zito with one out in the first inning.
"It looked like when Lucas hit that home run, it looked like we were going to have a big day and score some runs off Zito," Redmond said. "Give him credit, he pitched well and really kept us in check. We still had opportunities late in the game, but we just couldn't punch one across. Pence made that nice play to probably save the game for them."
Already in the series, Tom Koehler on Thursday collected his first big league win, and on Friday, reliever A.J. Ramos celebrated his first victory. Also on Friday night, Logan Morrison homered for the first time since July 6, 2012.
Lucas was able to receive the home run ball in exchange for an autographed bat.
"It was a great experience," Lucas said. "I wish it would have come in a winning effort. But a lot of firsts for me recently."
Turner got into the action with his first big league hit. It was a slow-rolling infield single that made it past Zito, and Brandon Belt drifted away from first base. Easily, Turner trotted to an uncovered first base, ending an 0-for-23 drought.
The Giants tied it at 1 in the fifth inning on a disputed spectator-interference call.
With two outs and Zito on first base, Blanco ripped a drive to deep right-center. The ball bounced up the high brick wall, and a fan pulled it in the seats. Immediately, interference was signaled by first-base umpire Mark Wegner.
Redmond questioned whether it was an automatic double, meaning the ball would have cleared the wall without the fan touching it. After exchanging a few words, the 42-year-old manager was ejected for the first time.
"He said it was fan interference, and it's their discretion," Redmond said.
According to Rule 3:16, the umpire has the discretion in fan interference to determine how far the runners would have advanced. Home-plate umpire Mike Winters ruled Zito scored, and Blanco was sent from third base back to second.
"To be honest, I don't really know what the ruling is there," Turner said. "He probably would have scored anyways. You never really know how it would have gone if the ball doesn't go into the stands. You kind of try to take it for what it is, and try to get the next guy."