Werder Bremen climbed out of the relegation zone after coming from a goal down to beat 10-man Union Berlin.