[...] teams have to log nine innings to get the wins, fame and fortune, and Gray and the A’s were apparently spent after the second inning. The Pirates pecked away at Gray until the fans at the Coliseum finally screamed, scoring seven unanswered runs for the 7-3 win. Down 4-3, Melvin rolled the dice and left his onetime ace out there in the sixth, and he had to be smiling when Gray retired the first two batters. [...] Gray hit Starling Marte with a pitch, walked David Freese and then gave up a line-drive RBI single to Matt Joyce. Melvin had no one up in the bullpen and then watched Josh Harrison hit a screaming double to drive in Freese and Joyce. Gray’s first wild pitch scored Andrew McCutchen in the fourth inning, the fourth time this season Gray has allowed a run to score on a wild pitch. In a twist, Pirates starter Jeff Locke (8-5) was the one struggling early. Locke gave up a two-run homer to Marcus Semien before he had recorded an out, and the A’s tacked on a run in the second on Jed Lowrie’s double. Semien, who has scored at least one run in nine straight games — longest streak for an Athletic since 2007 — is looking more and more like the team’s All-Star Game representative in a couple of weeks. After scoring six or more runs in seven straight games, Oakland scored the three early runs Friday and then managed only one hit over the last seven innings.