In the coming weeks, Hamels again hopes to follow in Cain's footsteps - this time pertaining to his contract.
Having matched up in a couple of pitchers' duels in the past, the Giants and Phillies could be primed for another low-scoring affair Saturday when Cain and Hamels square off at Citizens Bank Park.
Friday's opener was dominated by starters Tim Lincecum and Vance Worley early on, with the scored tied at 1 through five innings. San Francisco (52-41) got to Worley in the sixth, tagging him for five runs - highlighted by Brandon Crawford's grand slam - en route to a 7-2 win.
Crawford, who has two homers in his last three games after hitting one in his first 82, capped the scoring with a run-scoring single in the eighth to finish with a career-high five RBIs. The Giants improved to 6-1 since the All-Star break, and maintained their 2 1/2-game lead over Los Angeles in the NL West.
The Phillies (41-53), meanwhile, lost their second in a row following a four-game winning streak and are an NL-worst 17-28 at home.
"It is what it is right now,'' Worley said. "We have to keep going out there trying to win.''
Philadelphia is 12-6 behind Hamels (11-4, 3.07 ERA), but he has the difficult assignment of going up against Cain (10-3, 2.56). The two both rank in the top 10 in the NL in wins, strikeouts and innings.
One major difference between the two, however, is Cain signed a $127.5 million, six-year contract before the start of the season, while Hamels' contract is up after this year and his name has been mentioned in trade rumors. This could be one of his last starts for the Phillies, but the latest reports imply the team is working out a new contract extension similar to Cain's.
Either way, Hamels is trying to stay focused on the job at hand.
"I just have to go out and do my own business and make pitches and I think that's all I can be accountable for,'' Hamels said after allowing a run and six hits in eight innings in Sunday's 5-1 win over Colorado.
This will be Hamels' first start against the Giants after his turn in the rotation didn't come up in Philadelphia's trip to the Bay Area three months ago.
Cain took the mound in that series finale on April 19, and matched zeros with Cliff Lee through nine innings. Cain departed after nine having given up two hits and a walk and the Giants went on to win 1-0 in 11.
In Philadelphia last July 27, Cain allowed an unearned run and four hits in seven innings opposite Hamels in a 2-1 win.
Just over a week later in San Francisco, Hamels outpitched Cain with a seven-hitter en route to a 2-1 victory.
Since the start of last season, Ryan Howard, Chase Utley, Carlos Ruiz, Jimmy Rollins and Shane Victorino are a combined 2 for 38 against Cain, who allowed two runs and five hits over 6 1-3 innings in Sunday's 3-2 win over Houston.
San Francisco's Pablo Sandoval had some success against Hamels a year ago, going 3 for 8 with a solo homer.