Eliseu’s strike in the 82nd minute made it 2-1 to Malaga and left the hosts needing two goals to progress after last week’s first leg ended goalless.
Marco Reus breathed life into Jurgen Klopp’s side with a close-range finish in the first minute of stoppage time but there was even greater drama to come as Dortmund’s winner duly arrived with seconds remaining as Felipe Santana scrambled home.
“After the final whistle, everyone was close to a heart attack,” said Dortmund boss Jurgen Klopp. “That’s football, this is the beauty of the game.”
Joaquin’s 25th-minute opener for Manuel Pellegrini’s visitors was cancelled out by Robert Lewandowski’s superbly crafted goal five minutes before the break, but that was mere prelude to the drama — and acrimony — that was to come after the break.
Both Eliseu’s strike for Malaga and Santana’s third for Dortmund should have been ruled out for offside. Malaga owner Abdullah N’Ai Thani later took to Twitter to express his fury.
It contrasted with the nervy opening to the game before Malaga went ahead courtesy of their first meaningful attack. Julio Baptista found Joaquin, who exchanged passes with Isco before selling his marker a dummy and sending a low finish into the left corner.
Dortmund conjured a goal of real class five minutes before the break.
Mario Gotze’s incisive forward pass was backheeled beyond the Malaga backline by Reus into the path of Lewandowski, who expertly dinked the ball over the sprawling Willy Caballero before tucking the ball home under pressure from Jesus Gamez.
In a thrilling second half, the home fans were on their feet in the 75th minute ready to acclaim a goal as the unmarked Reus looked to turn home a low centre from six yards but Caballero’s trailing leg was in the right place as the Malaga number one made a wonderful save.
Caballero was again the hero for the visitors in the 79th minute as Gotze was played clean through but the goalkeeper flicked out a leg to deflect the ball inches wide of the post.
Caballero’s heroics looked set to be the cornerstone of a famous win when three minute later Malaga went 2-1 up as Baptista’s goalbound shot was turned home by Eliseu, despite having strayed offside.
But all that changed when Dortmund were awarded a free-kick 40 yards from goal. Woeful defending from the set-piece saw the ball break to Reus to fire in from close range. The hosts still needed a goal to progress to the last four, and incredibly it arrived in the third minute of added time.
The officials failed to spot three Dortmund players offside when the ball was put into the area. When the ball broke to Santana — also offside on the goal-line — he blasted home.
B DORTMUND: Weidenfeller, Piszczek, Subotic, Felipe Santana, Schmelzer, Gundogan (Hummels 86), Bender (Sahin 72), Blaszczykowski (Schieber 72), Gotze, Reus, Lewandowski.
MALAGA: Willy, Jesus Gamez, Demichelis, Sergio Sanchez, Antunes, Joaquin (Francisco Portillo 87),Toulalan,Camacho, Duda (Eliseu 74), Isco, Julio Baptista (Santa Cruz 83).
Referee: Craig Thomson (Scotland).