Heidenheim scored two goals after the 90th minute to stun Union Berlin and climb off the foot of the table on Matchday 12.