Bayern Munich 2 // Inter Milan 3 (3-3 on aggregate; Inter advance on away goals)
Pandev's goal in the 88th minute put the two teams level at 3-3 on aggregate, but Inter advanced on the away goals rule after losing the home leg 1-0.
Samuel Eto'o scored for Inter in the fourth minute, but Mario Gomez levelled in the 21st and Thomas Mueller put Bayern ahead in the 31st.
Wesley Sneijder scored in the 63rd to pull Inter level and Eto'o set up Pandev's winner.
Pandev scored off a pass from Eto'o, driving a left-foot shot into the roof of the net from inside the penalty box.
Eto'o had also set up Sneijder's goal, the Dutchman finding the far corner of Thomas Kraft's goal with a shot from the edge of the area.
Bayern controlled the match for most of the first hour but then allowed Inter to come back.
Inter became only the second team to advance in the Champions League after losing their home leg. The first was Ajax Amsterdam in 1996, then coached by Louis van Gaal and now the outgoing Bayern coach.
Bayern will now end the season without a title, after completing the domestic double last season and reaching the final of the Champions League, where they lost 2-0 to Inter.
Van Gaal has been forced to leave the club at the end of the season, one year early.
Inter got off to a perfect start, with Eto'o notching his eighth goal of the competition. Pandev sent in a through ball and the Cameroon striker beat the offside trap to slot the ball through the legs of Bayern goalkeeper Thomas Kraft.
Bayern took time to recover but when it did, the home side dominated Inter until the end of the first half. Inter's goal was also their only shot on target in the first 45 minutes.
Gomez equalised with his eighth Champions League goal after a mistake by Inter goalkeeper Julio Cesar.
Cesar let Arjen Robben's attempt from 20 metres bounce off his chest and Gomez pounced to hook the ball over the goalkeeper.
The Brazilian did well to punch away another effort by Gomez in the 26th minute, but he was helpless when Mueller put Bayern ahead.
Robben's pass struck the foot of Lucio and bounced straight into the path of Mueller, who had no trouble lifting the ball past Cesar.
Franck Ribery made a poor start, losing possession several times, but he recovered in style late in the first half.
The Frenchman easily went past Andrea Ranocchia and ran clear to face Cesar but the goalkeeper tipped Ribery's shot over the crossbar.
Ribery's cross to Gomez at the far post nearly produced a third for Bayern.
Gomez's effort found its way past Cesar, with the ball trickling across the goal. Ranocchia cleared from the line but his effort struck Mueller and the ball bounced off the post.
The goal scoring chances continued, with a late mistake by Ranocchia then turning into a perfect pass for Robben, who shot wide.
Ribery opened the way for Gomez at the start of the second half, but Cesar scooped the ball, while a tremendous volley by Gomez off a cross by Ribery in the 62nd was saved by Cesar.
Bastian Schweinsteiger then cleared the ball in front of Ranocchia.
At the other end, Pandev displayed superb control in taming a long pass, but his left-foot volley sailed high, then shot wide a few minutes later.
Sneijder had a good opportunity in the 73rd but also shot wide as Bayern lost their composure.
The match began with a minute of silence for the victims of the earthquake and tsunami disaster in Japan and Inter's late substitute Yuto Nagatomo stood in the centre of the field with a Japanese flag at the end of the match.