Heidenheim took their third win out of five this season in a game in which both sides were reduced to ten men.