Sixth-placed Eintracht Frankfurt ended a four-game winless run in the Bundesliga with a hard-fought victory in Heidenheim.