Borussia Dortmund advanced as the Group F winners after a dramatic 2-1 victory over 10-man Marseille.