Gyorko, who entered in a 3-for-28 slide, scored three runs and drove in another. Headley added two RBIs for the Padres, who have won four straight and six of seven.
Cashner (9-8) earned his first victory since Aug. 2, throwing 7-2/3 masterful innings, while limiting the Phillies to four hits and a walk.
Tyler Cloyd (2-4) was not sharp in his first major league start in three weeks for Philadelphia. The right-hander allowed seven runs and nine hits over four-plus innings.
ROCKIES 9, GIANTS 8
In San Francisco, Michael Cuddyer hit a tiebreaking homer leading off the ninth inning to go with his three-run shot, and the Rockies rallied from an early six-run deficit to beat the Giants.
Cuddyer sent a 3-2 pitch from Sergio Romo into the left-center seats for his 20th homer of the season, 10th career multi-homer game and second this year. He also connected in Colorado’s five-run fifth to spark the comeback.
Hunter Pence produced some impressive slugging himself, hitting a three-run homer in the first, an RBI double in the fourth and a tying, two-run single in the eighth against winner Wilton Lopez (3-4).
Pence matched his career high with six RBIs.
Sergio Romo (4-7) gave up Cuddyer’s go-ahead homer.
AP, ST PETERSBURG, Florida
Clay Buchholz allowed three hits over five innings in his first start since early June as the AL East-leading Boston Red Sox beat the Tampa Bay Rays 2-0 on Tuesday night.
Buchholz (10-0), sidelined by a strained neck, had not pitched in the majors since beating the Los Angeles Angels on June 8. The right-hander made three rehab starts in the minors.
Jonny Gomes and Jarrod Saltalamacchia both drove in a run for the Red Sox, who extended their lead over second-place Tampa Bay to 8.5 games. Craig Breslow, Junichi Tazawa and Koji Uehara finished a four-hitter. Uehara got four outs for his 19th save.
Reigning AL Cy Young Award winner David Price (8-8) lost his third straight start, despite giving up just three hits in eight innings. The left-hander struck out nine.
The Rays, just 4-12 since Aug. 25, lead the race for the second AL wild-card spot.
YANKEES 7, ORIOLES 5
In Baltimore, Maryland, Alfonso Soriano hit two home runs, including a tiebreaking shot in the eighth inning, as New York rallied past Baltimore to end a six-game losing streak at Camden Yards.
Mark Reynolds also homered for the Yankees, who won for the second time in six games to bolster their post-season hopes. New York still trail Tampa Bay, Baltimore and Cleveland in the hunt for the final AL wild-card slot.
Chris Davis hit his major league-leading 49th home run for the Orioles and raised his RBI total to 126. Baltimore led 4-1 in the fifth inning before faltering.
Alex Rodriguez led off the eighth with a double against rookie Kevin Gausman (2-5) and Robinson Cano delivered an RBI single. Soriano followed with a two-run shot to center, his 15th homer in 43 games since New York reacquired him in a July 26 trade with the Chicago Cubs.
Adam Warren (2-2) pitched a perfect seventh, while Mariano Rivera got four straight outs for his 650th career save.
ROYALS 6, INDIANS 3
In Cleveland, Ohio, Jeremy Guthrie got a major assist from his defense in pitching six innings, while Alcides Escobar hit a rare home run as Kansas City snapped a six-game losing streak in Cleveland to close on the Indians and two others in the cramped wild-card scramble.