A late Felix Klaus goal earned Freiburg all three points and took them out of the Bundesliga's bottom three by settling a 3-2 win over second-placed Bayer Leverkusen.
Lars Bender gave the visitors the lead for the first time in the fourth minute, but Admir Mehmedi levelled for the hosts.
Simon Rolfes put Leverkusen back in front 10 minutes before half-time before Jonathan Schmid levelled shortly after the interval.
Both sides pushed for a winner, and Freiburg found it with Klaus grabbing a winner in the last minute of the game to earn the Baden-Wurttemberg side three much-needed points.
Freiburg started the game brightly enough with Mehmedi testing Bernd Leno with a shot from 20 yards out, but they fell behind in the fourth minute when Bender tried his luck from the same distance, finding the bottom corner of Oliver Baumann's goal.
Emre Can went close to making it two when he struck the crossbar after Son Heung-min ran out of pitch having dribbled past Baumann, and Stefan Kiessling should have done better with a header straight into the arms of the Freiburg goalkeeper.
They paid for wasting those chances when Mehmedi took his next chance, curling the ball into the top right-hand corner of a motionless Leno's goal in the 26th minute.
Leverkusen restored their lead less than 10 minutes later when Rolfes headed Gonzalo Castro's corner home at the near post.
The home fans were livid as they felt Baumann had not made contact with Castro's shot which caused the corner, but the Freiburg goalkeeper did not protest, aware he had got his fingertips to the ball.
Another set piece led to Freiburg levelling in the 53rd minute.
His direct free-kick from the left skimmed off the head of Kiessling on its way past Leno, but the Freiburg midfielder will be claiming the goal as his own as he brought his side back on terms.
Back level for a second time, Freiburg this time sensed they could win it.
So too, however, did Leverkusen, producing an entertaining climax to the game.
Kiessling, Son and Castro all went close for Leverkusen while Mehmedi and Vladimir Darida missed good chances for Freiburg.
When time was just about up, Schmid broke clear down the right wing and pulled the ball back to Klaus.
The Dreisamstadion held its breath collectively as the Freiburg player met the ball near the penalty spot, and drove it home to spark scenes of jubilation as Freiburg moved out of the bottom three.