There are some out there (too lazy to do the linking thing but Taz and Kige are among them), who think that Phoenix trading Marion for Shaq is the worst trade of all time. Incorrect. I'll list some worse trades later, but the main point is, it's really not that bad of a trade.
Marion has an ego issue, where he feels, albeit rightfully so, that he is underappreciated. While Nash is winning MVPs, and Amare is viewed as the best forward on the Suns, Marion's array of talents really does go relatively unnoticed by the mainstream media. His being left off the All-Star team this season really didn't help this issue, plus there have been many instances where he has made moronic comments (for more info, check out :07 Seconds or Less, Jack McCallum's book on the Suns, where even D'Antoni talks about this).
Less than a year ago, Doc Rivers, Kenny Smith and Steve Kerr were asked if given 1 player to build a team around, who they would take. They each said Shaq. Of course he's not what he once was (and these admittedly aren't the greatest basketball minds of all time, although they are pretty knowledgeable about this kind of thing), but a healthy motivated Shaq is still one of the best centers in the league. He is a fantastic passer, and with all of the 3-point shooting Phoenix does it will really help them to have him down low. Phoenix's team as of last week was never going to win a championship if they had to go through San Antonio, which is all too likely. Now they have a more well-balanced team, and Shaq will for their sake hopefully not get destroyed by Duncan as Amare did in last year's playoffs.
Also, while Shaq's contract is terrible, he's got 2 years left where he'll be a Sun if they want them. Marion was almost definitely going to opt out after this season.
From the Heat's perspective, this is a fantastic trade. They get out of a horrific contract and bring in Marion, who as mentioned can opt out after this season. If he doesn't, fantastic, a team built around Wade and Marion can do a lot of cool things in the East, especially if they do as expected and make a play with their expiring contracts for Bibby and/or Artest in the offseason.
As for the worst NBA trade of the last 4 or 5 years, as Kige put it, there is no doubt it is the Knicks trading Penny Hardaway's contract and Trevor Ariza for Steve Francis. Francis was Marbury but worse, with a terrible contract, while Ariza is one of those solid young players you want on your team, and Penny's contract could've freed up a lot of space.
Honorable mentions to the Marbury trade, the Curry trade, the Malik Rose trade, and in the non-Knick division, the Baron Davis trade and the Magic trading McGrady for Francis (yep, him again) and other crap.