Okay, here's Miami's best case cap scenario, if their "big three" take max deals:
Lebron: $16.6 million
Bosh: $16.6 million
Wade: $16.6 million
Beasley: $5 million
Chalmers: $0.85 million
Cap Hold (x8) = $3.8 million
Joel Anthony: renounced (could re-sign for minimum deal)
With all of the above, the Heat are actually over the cap, at $59.45 million. That means that to sign Miller, each of the free agents would have to take less, and Beasley would have to be included in a sign-and-trade.
So, this scenario works:
Beasley traded straight up for Miller
Miller signs for $5 million
"Big three" sign for $16 million each
That would bring the Heat to $57.65 million, or very slightly below the cap.