Croatian Rebic scored either side of a Robert Lewandowski equaliser and Frankfurt added a third in stoppage-time to make amends for last season's final loss.
It was a bittersweet farewell for Bayern coach Jupp Heynckes, who will go back into retirement after taking over in October and leading them to their sixth straight Bundesliga title. Heynckes had coached them to the treble in 2013.
In a contrast of emotions, his Frankfurt counterpart Niko Kovac, who will take charge of Bayern next season, was lost in the arms of his players as he celebrated Frankfurt's first Cup win in 30 years.
Stellar Bayern crush Leverkusen to reach German Cup final
17/04/2018 AT 20:59
Bayern could have scored early when Lewandowski's free kick bounced off the crossbar but it was the underdogs who went in front when their pressing paid off in the 11th minute and Rebic was sent through to slot in.
Bayern squandered half a dozen golden chances through Bundesliga top scorer Lewandowski, Thomas Mueller and Joshua Kimmich before the break rescued Frankfurt.

Ante Rebic

Image credit: Getty Images

Poland striker Lewandowski made amends in the 53rd, sliding in to drill home a Kimmich cutback.
The game had lost some of its earlier pace but Frankfurt again pounced on sloppy Bayern defending for Rebic to put them back ahead.
With the Bavarians desperately searching for a late equaliser and keeper Sven Ulreich also going forward, Mijat Gacinovic found plenty of space to complete a break deep in stoppage-time and score into an empty net.
Bayern, Dortmund advance in German Cup as season start looms
12/08/2017 AT 15:40
Just give Chelsea the title now – The Warm-Up