Roberto Firmino struck an 87th-minute winner as Hoffenheim snatched three points from a topsy-turvy Bundesliga encounter with Eintracht Frankfurt this evening.
The visitors twice equalised at the Rhein-Neckar-Arena through Stefan Aigner and Haris Seferovic, but Firmino had the final word for Hoffenheim late on.
Former Blackburn Rovers striker Anthony Modeste squandered a series of early chances for the hosts, who also had Tarik Elyounoussi shoot wide from a good position.
Germany international Kevin Volland was in more clinical form and gave Hoffenheim a 43rd-minute lead by rounding the keeper and slotting home, after Firmino had done the donkey work with a 50-yard run.
Volland was denied a second shortly after the break by Timo Hildebrand, while Frankfurt came close through Alexander Meier and Seferovic and eventually got their equaliser when Aigner guided into the bottom corner on 58 minutes.
Hoffenheim brought on Adam Szalai in a bid to try to regain their lead and the substitute was in the right position to tap home the rebound to a Volland shot from a tight angle.
Frankfurt were determined not to let their opponents leapfrog them in the table and levelled things for a second time when Seferovic poked home from close range at the second attempt for his sixth of the season.
However, a moment of magic from Szalai, who back-heeled the ball through a congested penalty area during a goal-mouth scramble following a corner, allowed Firmino to snatch the hosts a 3-2 victory.
The result ends Frankfurt's three-match winning run and sees Hoffenheim climb above them to seventh in the standings.