There are exceptions to the First Amendment protections for Freedom of Speech, but I tend to think the Court found correctly here. The Westboro Baptist Church, however repugnant its doctrines, was expressing what is fundamentally a dissenting view on public policy. Everybody who's not a member of their crazy cult finds them insidious and bile-inducing, but we can't reject free speech because we don't like what people say, and that's basically what this comes down to.
The obvious precedents here are Chaplinsky v. New Hampshire (which creates the Fighting Words doctrine, which says that your offensive speech has to be immediatley directed to the recipient and likely to cause the average person to engage in a violent response) and RAV v. St. Paul, in which Scalia (the lone dissenter in the Phelps case) actually wrote the decision striking down a law under which a teenager was convicted of cross-burning on the grounds that while time, place, and manner restrictions which are content-neutral are fine, the government can't use those kinds of restrictions to favor one side over another. Phelps and his band of whackos were protesting in accordance with restrictions (certain distance from the funerals, under police supervision, etc.) so you can't ban them from saying whatever they want in that context anymore than you could ban someone from protesting at military funerals with signs arguing that we should send more troops or that President Obama is an alien from the planet Zardoz. Phelps wasn't calling for imminent lawless action and he wasn't directly addressing the funeralgoers with words intended to provoke violence.
Once we start banning speech because we find it offensive, rather than because it provokes imminent lawless action (the generalized principle behind the fighting words doctrine), we enter the slippery slope that SkywardET referred to; who's to say that laws could not also be passed banning anti-abortion protesters or criminalizing religious or racial slurs on the grounds that they cause offense similar to that which we see here? In the end, I think, this comes back to the famous aphorism ascribed to Voltaire by Evelyn Beatrice Hall - "I disapprove of what you say, but I will defend to the death your right to say it." As a country we see Phelps' pitiful protests of the funerals of fallen servicemen, and I like to hope that that reinforces - rather than reduces - our resolve in defending the principles we hold so dear.