Not that it matters, but why was Morton credited with the W with four innings of relief, when MLB wouldn't give Bumgarner the W with five innings of relief a few years ago?
Donutogre has bingo.In 2014, Affeldt was pitching in the game when the Giants took the lead, so he got the win. If the game was tied and then the Astros took the lead while Peacock was in the game, I'd guess it would have gone to him.
The rule for when the team leads when the starter exits but the starter doesn't go five is that "the official scorer shall credit as the winning pitcher the relief pitcher, if there is only one relief pitcher, or the relief pitcher who, in the official scorer’s judgment was the most effective, if there is more than one relief pitcher." Morton was clearly the most effective reliever.
In Affeldt's case, the reliever who is in the game when the team takes the lead is the winning pitcher unless the reliever "is ineffective in a brief appearance, when at least one succeeding relief pitcher pitches effectively in helping his team maintain its lead." Bumgarner was great, but Affeldt wasn't "ineffective," so he gets the win.