The Marlins, last in the Majors in runs scored, had one of their most productive three-game series of the season, scoring 20 runs. But until Sunday, they had little to celebrate.
"We had been struggling to score runs all year," Mathis said. "And we scored runs the last two days but couldn't come out on top. Today, it was back and forth. It was nice to get that one."
Steve Cishek polished off the ninth inning, getting pinch-hitter Buster Posey to tap into a 6-4-3 double play. It was Cishek's 22nd consecutive save and 27th overall.
The Marlins improved to 18-23 in one-run games, and they rallied to their 23rd comeback victory. They did so courtesy of some strange plays. They were assisted by a catcher's interference call on Hector Sanchez in the fourth inning. They also scored on a wild pitch.
Even the game winner came on Mathis' double, which involved the ball caroming off the arm of Andres Torres in center, deflecting into left field.
"I think you definitely saw a little bit of luck out there today for us," Miami manager Mike Redmond said. "We scored a couple of runs on some wild hops and a wild pitch there. Hey, we'll take it. Today is really one of those games where both teams battled back and forth. We wanted to take one of the games out of the series."
Ed Lucas singled and scored the game-winning run on Mathis' double.
"Sometimes it takes a fortuitous hop," Lucas said. "This time, it did. So many times this year, we've been in a game like this, where the pitching staff kept us in it. We've left runners on base and haven't got the big hit at the right time. Finally today, we put together a run late."
On Mathis' sinking liner, Torres attempted a diving catch, but he came up short and the ball deflected away.
"I tried, but I have to keep in front of it," Torres said. "Things like that happen. You don't want them to happen."
Neither team has much breathing room, and it wasn't easy for Cishek in the ninth. A key play was turned in by right fielder Giancarlo Stanton, who made a terrific play to cut off Sanchez's hit before it went to the wall. Had the ball gotten by him, Sanchez would have at least had a one-out double. Instead, he stayed at first.
"It's a huge play," Redmond said. "That really is just a hustle play. It would be easy for him to not get to that ball, play it off the wall for a double. In that situation, to make them put the ball in the gap to score that run with a single or blooper or whatever really was huge. It might have been the play of the game."
Cishek was able get the ground ball from Posey to end it.
The Giants outhit the Marlins, 13-9, and left 11 on base. Hunter Pence belted a two-run homer and had three RBIs, and Brandon Crawford connected on a solo shot for San Francisco.
A back-and-forth game swung in the Giants' favor again in the seventh inning off reliever Mike Dunn. Crawford homered to open the inning, tying the score at 4. And Sanchez's two-out RBI double put San Francisco in front, 5-4.
Again, Miami responded, pulling even in the seventh on Donovan Solano's RBI double off reliever Guillermo Moscoso.
Both starters had their struggles, and neither was involved in the decision. Miami's Tom Koehler worked five-plus innings, giving up three runs on seven hits with four walks and four strikeouts. And San Francisco's Madison Bumgarner lasted five innings, allowing four runs on five hits. He also walked four. Both starters allowed a home run and threw a wild pitch.
"In the first game of the series, we fought really hard and unfortunately couldn't come out on top," Koehler said. "To be able to come out there and fight, everybody the entire game, it was a nice team win. It just goes to show this team, when we stay together, we're never out of it."
The Marlins grabbed a 4-3 lead in the fifth inning, manufacturing the go-ahead run on Bumgarner's wild pitch on ball four to Justin Ruggiano. Solano, who walked with one out in the inning, scored from second when the ball bounced away from Sanchez, who couldn't immediately locate it.
In each of the three games, the Giants broke on top early. Pence provided early power Sunday, blistering Koehler's 2-1 fastball well beyond the home run sculpture in center.
Miami trimmed its deficit to one run in the third inning. Mathis collected the first hit off Bumgarner, and it was a big one -- a home run to left.
"I give our guys a lot of credit for going out there, competing, not giving up," Redmond said. "At the end of the day, we came out of there with a win in a one-run game."