On 3 January 2009, Olić signed a three-year contract with Bundesliga rivals Bayern Munich. He joined the club on a free transfer on 1 July 2009. Initially, he was supposed to be back-up to the likes of Miroslav Klose and Mario Gómez, but due to injury and fitness issues, he began to be preferred as the club's first choice. On 8 August, his Bayern debut, he scored the opening goal against 1899 Hoffenheim in a 1–1 draw and soon became a favourite with the Bayern fans. He reached new heights upon scoring a crucial goal in the 2010 Champions League quarter-final (first leg) against Manchester United in injury time, to give Bayern a slender 2–1 lead. He also scored the first goal in the second leg for his team, but they trailed 3–1. The game ended 3–2. Bayern, however, won on away goals. He scored his first hat-trick for the Bavarians against Lyon, scoring with his left foot, right foot, and his head, in the Champions League semi-final second leg on 27 April 2010. The victory against Lyon secured his team a place in the final against Internazionale, which they eventually lost 2–0. On 3 April 2012, he scored a brace in a 2–0 win against Marseille in the 2011–12 UEFA Champions League quarter-finals. Olić played his final game for Bayern in the 2012 UEFA Champions League Final against Chelsea, in which he came on as a 97th-minute substitute for the injured Franck Ribéry. Bayern eventually lost the game in a penalty shootout when the game ended 1–1 after extra time. Olić missed the team's fourth penalty, as they lost the shootout 4–3.