Cobb, who was stretchered from the field after being struck on the head by a line drive from Kansas City's Eric Hosmer on June 15, allowed one run on three hits and two walks, striking out six.
He got support from Wil Myers, who drove in four runs on three hits, and Evan Longoria's two-run shot in the fifth.
Matt Holliday's RBI single in the 12th gave the St Louis Cardinals a 6-5 victory over Pittsburgh and their second walk-off win against the Pirates in three days.
Russell Martin had launched a solo shot in the eighth to send the game to extras, but Holliday plated Matt Carpenter, who reached base five times, to seal the win for the Cards.
The rest of the scoring had all taken place in a wild fifth inning which saw St Louis register five runs and Pittsburgh four, including Clint Barmes' two-run homer.
Sonny Gray pitched eight shut-out innings for his first Major League win as the Oakland Athletics beat the Houston Astros 5-0.
Gray scattered four hits, fanning nine and walking one, while fellow rookie Nate Freiman drove in four runs on four hits, including a two-run homer.
Andy Dirks had four hits and Prince Fielder cracked his 18th homer of the season - a two-run effort in the first - to give the Detroit Tigers a 4-1 win over the Kansas City Royals.
Joey Votto smacked a go-ahead homer in the sixth as the Cincinnati Reds beat the Milwaukee Brewers 2-1 to extend their winning streak to five matches.
Pinch-hitter Hector Sanchez launched a three-run homer in the ninth as the San Francisco Giants rallied for a 4-3 win over the Washington Nationals.
Chris Nelson crushed two home runs - his first career grand slam and a solo shot - to lift the Los Angeles Angels to a 8-4 win over the New York Yankees.
The Toronto Blue Jays edged out the Boston Red Sox 2-1, the Minnesota Twins were 4-3 winners over the Chicago White Sox and the New York Mets saw off the San Diego Padres 4-1.