SAN FRANCISCO -- Miami Marlins manager Mike Redmond got one issue cleared up Thursday afternoon, only to leave AT&T Park scratching his head about something completely different at the end of the night.

On a day that began on a negative note when ace right-hander Jose Fernandez formally announced he would undergo season-ending Tommy John surgery on his right elbow Friday in Los Angeles, the Marlins suffered a hard-to-swallow, 6-4 defeat at the hands of the San Francisco Giants.

In question as the Marlins bused back to their hotel was an umpire's error that was deemed not reviewable, a play critical to a three-run Giants rally in the fifth inning that produced the eventual margin of victory.

The Giants trailed by three runs on two occasions early in the game, and they were still behind 4-3 when center fielder Angel Pagan led off the difference-making fifth with a walk off Marlins right-hander Nathan Eovaldi (2-2).

Right fielder Hunter Pence then hit a chopper up the first base line. The ball hit Pence in the left foot while it was in fair territory about 40 feet up the line and caromed into foul ground, after which plate umpire Lance Barksdale called it foul.

The umpires converged and ruled that the ball never hit Pence, which the Marlins clearly could tell was incorrect on television replays. But because Major League Baseball's new video-review rules prevent umpires from reviewing fair/foul calls in the infield, the umpires informed Redmond he could not challenge the ruling.

"They said it didn't hit him," Redmond said. "That's all I can go by."

Asked if he had considered asking for a review based not on fair/foul but on whether a batted ball hit a baserunner, Redmond insisted the umpires did not give him that option.

The thought of having a key call go against him on a technicality clearly bothered Redmond.

"If we're going to emphasize getting all the calls right, let's get them right," he said, reiterating that reviews clearly showed that Pence should have been called out.

Eovaldi never recovered from the long delay and the loss of an out. He gave up a hit-and-run single to Pence on the next pitch, then fell behind 5-4 when Giants catcher Buster Posey smacked a two-run double to right-center field.

Left fielder Michael Morse, who hit a two-run homer two innings earlier, drove in Posey one out later with a single, and Eovaldi was gone after left fielder Tyler Colvin followed with his second of two doubles.

"An out is an out," Redmond said, noting the importance of the Pence play in the uprising. "That would have been a big out there, at a time when we needed an out."

Left-handed reliever Brad Hand escaped further damage, but the Marlins never scored again against right-hander Matt Cain and the Giants bullpen, getting only two hits in the final six innings after building an early 4-1 advantage.

Cain (1-3) snapped an 11-game winless streak dating back to last season. He came out on top despite allowing home runs to Marlins second baseman Derek Dietrich and first baseman Garrett Jones in the first two innings.

"After (falling behind early), all you can do it try to keep them from scoring more," Cain said. "These guys did a good job coming back."

Morse drove in three runs with a home run and two singles, Pence had three hits and scored twice, and the Giants won for the eighth time in their past 10 home games.

In winning for the first time since beating the Marlins last Aug. 17, Cain pitched a season-high 7 2/3 innings, allowing six hits and four runs. He struck out seven and walked three.

"We're really swinging the bats well this year," he said. "Even when we're not pitching our best, the mentality we have to have is: Give these guys a chance to do something for you."

Right fielder Giancarlo Stanton had one of the six hits off Cain, a fifth-inning single that extended his hitting streak to 17 games. It is the longest active run in the majors.

Giants closer Sergio Romo recorded his 14th save with a perfect ninth inning.

Eovaldi pitched a season-low 4 1/3 innings, giving up six runs on nine hits. He walked two and struck out two.

NOTES: The Giants are 11-3 in series openers this season. ... San Francisco LF Michael Morse's home run was his 10th of the season. He became the first Giant since LF Barry Bonds in 2007 to have as many as 10 homers in the club's first 42 games. ... The two home runs off Giants RHP Matt Cain in the first two innings marked his third multiple-homer game of the season. Only three other National League starters -- Milwaukee Brewers RHP Marco Estrada, Los Angeles Dodgers LHP Paul Maholm and Pittsburgh Pirates LHP Wandy Rodriguez -- have allowed two or more homers in three games this season. ... Giants RHP Tim Hudson was scratched from his scheduled Friday start against the Marlins because of a strained left hip. RHP Yusmeiro Petit will make his third start of the season in Hudson's place. ... Marlins manager Mike Redmond announced that RHP Anthony DeSclafani, who beat the Los Angeles Dodgers in his major league debut Thursday, would continue to pitch in the rotation spot vacated by injured RHP Jose Fernandez. Veteran LHP Randy Wolf, signed Thursday to replace Fernandez on the active roster, will remain in the bullpen after recording his first career save in the 13-3 win over the Dodgers.