Marlon Byrd, right, is greeted by teammate Eric Young Jr.,...

Marlon Byrd, right, is greeted by teammate Eric Young Jr., left, after hitting a grand slam to left field off San Francisco Giants relief pitcher Jake Dunning in the eighth inning. (July 9, 2013) Credit: AP

Twice Tuesday night, the Mets squandered leads against the Giants. But with one timely swing, Marlon Byrd ensured it wouldn't happen a third time.

After Daniel Murphy's sacrifice fly pushed the Mets ahead by a run in the eighth, Byrd followed with the seventh grand slam of his career, which proved to be the knockout blow in the Mets' 10-6 win over the Giants.

Byrd, who has emerged as a trade chip for the Mets, blasted his 14th homer of the season on the first pitch he saw from Giants reliever Jake Dunning.

"You don't always come through," Byrd said. "But it's one of those things where when you do, it just feels good."

"He's been a huge, huge force in the middle," manager Terry Collins said of Byrd. "When we moved Ike [Davis] out, we had to have somebody who drove in some runs behind David [Wright] because they were just pitching around him. We needed somebody to step in there and get some big hits and Marlon has done that for us. He's really been a good find for us."

So with the big homer and big inning, the Mets assured themselves of their second series victory on this nine-game road trip, perhaps a bit of consolation after absorbing some sobering news earlier in the day.

Pitcher Shaun Marcum's union with the Mets ended Tuesday when the pitcher decided to have season-ending surgery, essentially terminating a marriage that produced various nagging injuries but little in the way of victories.

Marcum, 31, was diagnosed with thoracic outlet syndrome, a vascular condition that caused numbness and tingling in his right hand. Mets assistant general manager John Ricco said Marcum will have the surgery Monday at the recommendation of both team doctors and vascular specialist Robert Thompson, who examined the pitcher in St. Louis on Monday.

Marcum went 1-10 with a 5.29 ERA in just 78 1/3 innings after signing a one-year deal worth a base salary of $4 million. The Mets added the veteran in hopes of bringing some stability to the starting rotation.

However, from the middle of spring training, Marcum dealt with various physical issues culminating in numbness and tingling in his arm. The condition has also afflicted big-league pitchers Chris Carpenter and Mike Adams.

Marcum joins a list of free-agent whiffs the Mets have suffered during Sandy Alderson's tenure as general manager. This offseason, Marcum and reliever Brandon Lyon represented the Mets' two acquisitions on the free-agent market. Lyon was designated for assignment on Thursday.

Righthander Carlos Torres remains the front-runner to eventually slide into the rotation. Since his promotion from Triple-A Las Vegas on June 15, Torres has allowed just one run 15 2/3 innings with an 0.57 ERA.

The Mets recalled righthander Gonzalez Germen to take Marcum's spot.

With his diagnosis, Marcum joins rotation mates Johan Santana and Jonathon Niese on the shelf.

"We're missing three-fifths of our rotation already this half," Collins said before the game. "So if that happens in the second half, I'm not sure where the replacements are going to come from."

Indeed, the rest of the rotation will have to pick up the slack, though Dillon Gee struggled with that task Tuesday night. He spent most of his outing working out of trouble before the Giants chased him with two outs in the seventh and the score tied 5-5.

"We needed innings," said Collins, who has been working with a taxed bullpen. "We needed a lot of innings from Dillon and he hung in there."

A pair of poor throws by Anthony Recker and Daniel Murphy helped the Giants take a 2-0 lead in the second, though the Mets rallied for three runs in the fourth on Andrew Brown's two-run single with the bases loaded.

Pablo Sandoval's groundout in the fifth knotted the game at 3 before Recker's two-run homer in the sixth pushed the Mets lead to 5-3. But again, Gee failed to preserve the lead.

Pinch hitter Tony Abreu's cue shot in the sixth cut the lead to one before Sandoval's sacrifice fly in the seventh evened the score. Gee allowed five runs, nine hits and five walks in 6 2/3 innings.

Newsday LogoCovering LI news as it happensDigital AccessOnly 25¢for 5 months