Cain reached the playoffs for the second time in his career as the Giants won the NL West after missing the playoffs in 2011. In Game 1 of the NL Division Series against the Cincinnati Reds on October 6, he allowed three runs in five innings and took the loss as the Reds defeated the Giants 5–2. In Game 5 on October 11, he began the game with four scoreless innings; Cain would allow three runs over innings as the Giants won 6–4 to advance to the next round of the playoffs. In Game 3 of the NLCS against the Cardinals on October 17, Cain allowed three runs in innings and was charged with the loss as the Giants lost 3–1. On October 29, in Game 7, Cain threw shutout innings and earned the win as the Giants won 9–0, marking the second time in the playoffs that Cain had won a series-clinching game. In Game 4 of the 2012 World Series against the Tigers on October 28, Cain allowed three runs in seven innings, earning a no-decision as the Giants won 4–3 in 10 innings to win the World Series for the second time in three years.