San Francisco became the first team in MLB history to win on a walk-off slam after trailing by eight runs in the eighth inning.