With 27 seconds left and the Miami Heat leading by two, Dwyane Wade stood near the 3-point line and dribbled long enough for LeBron James to come over and set a screen on Dion Waiters.

When Wade dribbled around James, the entire lane opened and no Cavs player got in his way. In fact, Alonzo Gee seemed to step out of his way and open an even bigger path to the basket — because Gee was sticking with James rather than switching, as Cavs coach Byron Scott had instructed during a timeout 2½ minutes earlier.

Wade’s huge dunk with 24 seconds left propelled the Heat to a 109-105 victory over the Cavaliers in a game they probably should’ve won. The Cavs rallied from a 22-point deficit early in the third quarter to grab a one-point lead entering the fourth, then extended it to 97-89 on a 3-pointer from C.J. Miles with 5:16 left.

But just as the first meeting here in late November, the Cavs crumbled on both ends in the game’s final minutes, allowing the defending champions to escape and push their winning streak to 11.

It was the mental mistakes at both ends that had Scott aggravated.

“With five minutes to go in a basketball game and you have a chance to win, you’ve got to be focused,” Scott said. “As a basketball player, you’ve got to be totally focused on everything we’re talking about doing. You can’t come out there not knowing that we’re going to switch, not knowing what we’re going to run on the offensive end. Those breakdowns are unacceptable and they can’t happen.”

Scott said Gee and C.J. Miles were on the wrong side of the court coming out of a huddle late in the game, and therefore botched the play that was just diagrammed. Then the Cavs lost Shane Battier in transition and Battier stung them with a 3-pointer from the corner to give the Heat a 103-101 lead with 1:27 left. Then Gee failed to switch on the pick-and-roll that left Wade clear sailing for the easy dunk.