Substitute Maximilian Beier scored deep into added time as Borussia Dortmund bounced back from defeat to Bayern Munich with victory at home to Cologne.