SAN FRANCISCO -- Matt Cains winless drought is over, even though the Giants three-time All-Star pitcher is still struggling with some of his mechanics. After nearly seven weeks of frustration, Cain isnt about to complain. Buster Posey hit a go-ahead double as part of a three-run fifth inning and San Francisco held on to beat the Miami Marlins 6-4 on Thursday night. Cain (1-3) earned his first win of the season despite another shaky outing at AT&T Park. The former San Francisco ace gave up two home runs and allowed all the Marlins scoring in the first three innings before settling down to pitch into the eighth. "He didnt cave in," Giants manager Bruce Bochy said. "He gave up four runs in the first three innings and here he is in the eighth. It says a lot about him. Good for him. Its got to be a good feeling." Cain hadnt won since Aug. 17, 2013 -- a string of 11 consecutive starts. It looked like the drought might continue after Cain was nearly knocked out of the game in the third inning, but he stuck around long enough to get the win in his second outing since slicing the index finger on his right hand. After giving up two home runs to the first seven batters he faced, Cain settled down to allowed six hits over 7 2-3 uneven innings. He struck out seven and walked three. "I made some bad pitches and those guys really capitalized on it," Cain said. "I was making good pitches other than that. I just needed to eliminate the big one that kept costing me." Mike Morse homered for the second consecutive game and drove in three runs while Hunter Pence added three hits and scored twice for the Giants, who trailed by three runs before rallying to bail out Cain. Garrett Jones hit his sixth home run for Miami. The Marlins had won 12 of their last 15 games at the Giants waterfront ballpark and were comfortably ahead 4-1 before San Franciscos comeback. "We swung the bats great in the first three innings," Miami manager Mike Redmond said. "We have to do a better job of shutting them down after we score. We have to do a better job of executing our pitches and shutting them down." Morse, who finished with three hits, cut the gap to 4-3 when he hit a two-run home run off Miami starter Nathan Eovaldi (2-2) in the third. The Giants took the lead for good in the fifth after Angel Pagan drew a leadoff walk and Pence singled. Posey followed with his towering drive to right-centre. Morse added an RBI single. Jeremy Affeldt retired one batter and Sergio Romo worked the ninth for his 14th save. Miami couldnt capitalize off the quick start and was held scoreless over the final six innings. The Marlins announced before the game that ace Jose Fernandez will have Tommy John surgery Friday, ending the season for the reigning NL Rookie of the Year. "Our focus is to get him back," Redmond said. "Im glad hes having it done and starting his recovery process. Obviously its a big blow for us." Giancarlo Stanton singled in the fifth to extend his 17-game hitting streak but the Marlins dropped to 2-6 on their 11-game road trip. Cain fell behind early after giving up a solo home run to Derek Dietrich with one out in the first. Miami added two runs in the second on Jones two-run homer, then made it 4-1 on Casey McGehees RBI double in the third. Eovaldi gave up an RBI groundout to Brandon Hicks in the second then retired four straight following Morses home run until the Giants broke the game open in the fifth. Eovaldi allowed nine hits and six runs over 4 1-3 innings. NOTES: Pablo Sandoval went 1 for 4 in his return to the Giants lineup after leaving Sundays win over Atlanta with a sore toe. ... RHP Anthony DeSclafani, who made his major league debut Sunday in Fernandezs place, will remain in the Marlins rotation for now. ... RHP Henderson Alvarez (2-3) pitches Friday and makes his second career start against the Giants. ... Tim Hudson was scheduled to pitch for San Francisco but has been scratched due to a hip strain. RHP Yusmeiro Petit (2-1) will start in Hudsons place. Anton Khudobin Jersey . Basketball fans around the globe will be watching as Kobe Bryant makes his season debut - 240 days after tearing his left Achilles - against Toronto, a team he has used as his own personal punching bag. Craig Hartsburg Stars Jersey . In the days leading up to the draft, TSN.ca and TSN Radio basketball analyst Duane Watson looks at some of the names that will be headlining the event. Tonight, Michigans Nik Stauskas of Mississauga, Ontario. http://www.thedallasstarshockey.com/mike-modano-hockey-jersey/ .Hammel pitched inside more and it helped him get into the seventh inning as the Colorado Rockies beat the San Diego Padres 3-2 on Friday night. Esa Lindell Jersey . With newly minted president of hockey operations Trevor Linden looking on from above one day after being handed the keys to the franchise, it was more of the same on Thursday night. Jaromir Jagr Stars Jersey . According to Tony Barrett of The Times, the Liverpool captain is set to announce that he will leave the club at the end of the 2014-15 season.MINNEAPOLIS -- Kansas Citys James Shields is accustomed to pitching in close games this season. He kept his team in the game until the Royals were able to break through late. Shields was sharp for 7 1-3 innings, Alex Gordon had three RBIs, and Kansas City scored five runs in the eighth inning to beat the Minnesota Twins 6-1 on Tuesday. "The way Shields was pitching, it was like, Ok, just hold em until we can break something open," Royals manager Ned Yost said. "Finally, in the eighth it got broken open." Shields -- the key part in the deal that sent top prospect Wil Myers to Tampa Bay in the off-season -- struck out seven and notched his American-League best 22nd quality start. Shields (9-8) went over the .500 mark and only allowed one hit through seven innings before running into trouble and leaving in the eighth. While the wins havent been there for Shields, hes pitched well. "Ive got a ton of quality starts this year and I feel like Ive been pitching well all year," Shields said. "The wins are going to come. Im not really too worried about it. Im just going to keep grinding out the rest of the season and hope for the best." Kevin Correia struck out a season-high seven over seven shutout innings, but ended up with a no-decision. Brian Dozier had the Twins RBI. Seven consecutive Royals hitters reached base in a five-run eighth that broke open a scoreless game and handed reliever Jared Burton (2-8) his third loss to Kansas City this season. The first two runs scored on a bloop single from Chris Getz and a Jarrod Dyson bunt. Gordon followed with a bases-clearing double down the right-field line that made it 5-0 and sent most of the fans at a steamy Target Field heading for the exits. Burton also lost Sunday in Cleveland. "Ill talk to Burton a little bit tomorrow about what he did and how he felt and what he was thinking, and then we move on," Twins pitching coach Rick Anderson said. Billy Butler hit his 14th home run in the ninth. After losing seven straight and damaging their playoff chances, the Royals have won three in a row. "You have to fight through it," Dyson said. "Thats the great part about us. We fight through everything." After walking Ryan Doumit in the second, Shields retired 14 off the next 15 batters and held the Twins until the offence got him some support.dddddddddddd Wade Davis, the other pitcher Kansas City acquired in the Myers deal, hasnt been nearly as effective and was demoted to the bullpen on Tuesday. Danny Duffy will be called up on Wednesday from Triple-A Omaha and take Davis slot in the rotation. The Twins have struggled to score since All-Star Joe Mauer went on the disabled list a week ago with a concussion. Minnesota had a chance to cut into the lead after Doziers double chased Shields and made it 5-1 in the eighth. But Will Smith struck out Chris Herrmann and Justin Morneau with runners on second and third to end the threat. The Twins struck out 11 times and were 1 for 9 with runners in scoring position. "Good ball game until we got into the eighth, and then things kind of unraveled there, we couldnt really stop them," Twins manager Ron Gardenhire said. "The ball kept going their way, bunts, you name it, everything, stolen bases, bloops, and there you have it, a five spot." NOTES: Davis is 6-10 with a 5.67 ERA and will move to the bullpen. ... Twins general manager Terry Ryan said its still to be determined if Mauer will make the upcoming road trip to Texas. Ryan also said that Mauer is making progress in his recovery from a concussion. ... Twins manager Ron Gardenhire said OF Oswaldo Arcia will probably be out for at least a few more days with a sore hand. ... The Royals signed Carlos Pena to a minor-league contract and assigned him to Triple-A Omaha. Pena, 35, hit .209 with eight homers in 85 games for Houston before being released on July 31. ... Kansas City also traded minor-league OF Quintin Berry to Boston for minor league reliever Clayton Mortensen. ... Twins 1B Chris Colabello was selected the International MVP and Rookie of the Year. He hit .352 with 24 home runs. ... The Royals bumped Bruce Chen back a day so Duffy could start Wednesdays game against the Twins. Duffy had elbow surgery last season and has made two spot starts for Kansas City in August, allowing two runs in 9 2-3 innings. ... Andrew Albers (2-1, 3.00 ERA) makes his fifth major league start for the Twins on Wednesday. Albers pitched 8 1-3 scoreless innings in his major-league debut against the Royals earlier this season. ' ' '