In the film Bambi, Bambi's friend Thumper says his mother taught him, "If you can't say anything nice, don't say nothin' at all." No doubt someone will come up with an earlier source.
There is a Latin saying, which of course rather predates Bambi: "De mortuis nil nisi bonum", "Speak nothing but good of the dead", which is rather along the same lines.
This page says it is of unknown authorship, while another reference, Roget's International Thesaurus 1922, ascribes it to Horace.
There's also a theory in Communication that states that the best way to change a person's way of speach is to change the way the person speaks. One of the first steps is to stop speaking negatively and not say anything. Once a person has achieved that they are more easily able to speak in a more positive tone. So if you can't say anything good, don't say anything at all until eventually you have better thoughts and will say something nice instead of mean.