Why God Allows Sin and Suffering
Though [God] hates sin in itself, yet he may will to permit it for the greater promotion of holiness in this universality, including all things and at all times. So, though he has no inclination to a creature's misery, consider it absolutely, yet he may will it for the greater promotion of happiness in this universality.
God inclines to excellency, which is harmony; but yet he may incline to suffer that which is unharmonious in itself, for the promotion of universal harmony or for the beautifying of the harmony that there is in the universality, and making of it shine the brighter. (Miscellanies #170, paragraphing added)
Not surprisingly, John Piper agrees with Edwards on this point. To see him expound it from scripture, check out the sermon "All Things Were Created Through Him and for Him."