Frankfurt - led by manager Niko Kovac in his final game before he succeeds Jupp Heynckes as Bayern boss - took the lead after only 10 minutes when Ante Rebic clipped the ball past an advancing Sven Ulreich.
Robert Lewandowski netted a deserved equaliser for double-chasing Bayern eight minutes into the second half, but any hopes of ending Heynckes's latest managerial reign with a 19th cup title were ended when Rebic and Mijat Gacinovic wrapped up a historic victory for Frankfurt late on.
The title is Frankfurt's fifth overall and first since 1980, and is also enough for them to secure Europa League football next season as Stuttgart - who finished seventh in the Bundesliga - miss out.
The first sight of goal fell to Bayern when Thomas Muller blazed an effort over the top after only five minutes, and they came closer still shortly afterwards as Lewandowski crashed a powerful free kick against the crossbar with goalkeeper Lukas Hradecky beaten.
However, it was Frankfurt who broke the deadlock just one minute later, launching a devastating counter-attack after spending the opening 10 minutes on the back foot as Kevin Prince Boateng's through-ball found Rebic, who finished with aplomb past Ulreich.
The Bundesliga champions wasted little time in responding to that early setback, though, and they were soon on the attack once again with Muller miscuing a headed effort from James Rodriguez's wicked delivery.
Joshua Kimmich was the next to come close for Heynckes's side, but he could not get enough on his header to convert Muller's cross as Frankfurt continued to hang on to their slender lead.
A Bayern equaliser looked increasingly inevitable, though, and they should have provided it just three minutes later when Lewandowski was played through, only to clip his finish across the face of goal and agonisingly wide.
Frankfurt were struggling to relieve the relentless pressure from the 18-time cup winners, and Muller again came close shortly after the half-hour mark with a powerful strike from range which stung the palms of Hradecky.
Lewandowski then fired another free kick off target as the ball refused to go in for the dominant Bavarians, and Frankfurt managed to hold out until half time with their lead still intact.
Any half-time nerves may have been cranked up a few notches when kickoff was delayed due to a cloud of smoke caused by flares being let off, but it was Frankfurt who had the first sight of goal after the restart when Jetro Willems nodded the ball into the arms of Ulreich.
Bayern did finally find their equaliser shortly afterwards, though, as Kimmich's cut-back into space was met by Lewandowski, who poked the ball home for his 41st goal of the season.
Ulreich was busier in the second half than he was in the first, saving from Omar Mascarell with just over 20 minutes remaining, but it was still Bayern who looked the far more likely to go on and get a winning goal, with only a last-ditch challenge from Makoto Hasebe denying Corentin Tolisso a clear chance.
Lewandowski then saw a deflected effort drop inches wide of the target before the woodwork came to Frankfurt's rescue for a second time when Mats Hummels climbed highest in the area and sent his dipping header against the crossbar with just 10 minutes remaining.
Rebic went straight up the other end and curled an effort of his own wide, but the striker would complete a smash and grab move just two minutes later when he raced clear of the defence before clipping his finish past Ulreich - a goal which was allowed to stand after the video assistant referee ruled out suggestions of handball in the buildup.
Suddenly last season's beaten finalists found themselves on the verge of their first victory over Bayern since 2010, but they were forced to negotiate some nervy moments in the closing stages of the match, with Kimmich heading a particularly good chance over the bar.
VAR also played its part in stoppage time when Bayern were denied a penalty, and their final glimmer of hope was extinguished in the sixth minute of added-on time as Frankfurt put the seal on their memorable triumph with a third goal.
Ulreich was in the opposition penalty area for a corner as Frankfurt cleared, releasing Gacinovic who carried the ball from the edge of his own box into the Bayern area before stroking it into an empty net to spark scenes of wild celebrations from the underdogs.
BAYERN MUNICH (4-3-3): Ulreich; Kimmich, Sule, Hummels, Alaba; Rodriguez, Martinez, Thiago (Tolisso 64'); Muller (Coman 70'), Lewandowski, Ribery (Wagner 87')
EINTRACHT FRANKFURT (4-1-4-1): Hradecky; Da Costa, Abraham, Salcedo, Willems; Hassebe; Wolf (Gacinovic 60'), Mascarell, De Guzman (Russ 74'), Rebic (Haller 89'); Boatengbody check tags ::