Bayern oust Real in thrilling contest