Arne Slot's side made a dream start to the match when Santiago Gimenez gave them the lead after less than five minutes, but goals from Edson Alvarez and Dusan Tadic turned the game on its head before half time.
Feyenoord were back level seven minutes after the restart courtesy of Sebastian Szymanski's goal, though, and then secured a famous victory at the home of their greatest rivals through Lutsharel Geertruida's header four minutes from time.
The victory takes Feyenoord six points clear of Ajax at the top of the table, making them now firm favourites to dethrone their opponents and win the title for the first time since 2016-17.
Ajax would have moved above their Rotterdam rivals had they won, and they had every reason to be confident having won 14 and lost none of their last 16 home games against Feyenoord, with the hosts' substitute Jorrel Hato not even born the last time his side lost this fixture in front of their own fans.
Johnny Heitinga's side had also won each of their last seven matches in the Eredivisie, but they found themselves behind after just five minutes when Gimenez slotted home early on.
Recent history looked like it could be repeating itself when his compatriot Alvarez restored parity with a firm header 12 minutes later, and Tadic then put the hosts ahead by steering the ball into the bottom corner in the 37th minute.
Feyenoord, who have won more points from losing positions than any other team in the top 10 European leagues this season, would not be denied on this trip to Amsterdam, though, and Szymanski fired home Alireza Jahanbakhsh's low cross from the right to level things up again shortly after the restart.
It took a stunning save from Timon Wellenreuther to deny Mohammed Kudus and keep those scores level before the dramatic late winner.
Geertruida's near-post header from the corner was Feyenoord's latest winner in De Klassieker since 1969, ending a seven-game winless run against their bitter rivals home or away, in addition to that 18-year drought in Amsterdam.
For Ajax it is only a second home league defeat in their last 21 such outings, but most importantly it leaves them six points adrift with only eight games of the season remaining.
Heitinga's men next face Go Ahead Eagles after the international break, while Feyenoord face a derby against Sparta Rotterdam, before the two rivals renew hostilities in the semi-finals of the KNVB-Beker on April 5.