I think it was one of the best deals Memphis could get under their circumstances. It saves more than $10 million this year (~$6 mil in salary, plus ~$4 mil in tax payments), plus whatever piece of the pie they now get from the tax redistribution as a non-tax-paying team; it also takes another $4.5 mil in salary off the books for next season. Even though the latter likely isn't enough to enable the Grizzlies to keep Gay next season, it 1) gives them more flexibility in a potential Gay trade, as they can take back a little more salary, and/or 2) allows them to add or re-sign free agents who fit their needs more than Speights did.
Given that Cleveland is taking on more than $10 million in additional salary over this season and next season (while saving Memphis even more than that), the pick seems like fair compensation, especially with the top protections on it severely reducing the likelihood of it completing blowing up in Memphis' face.