This is something I wrote back in the Fall (slightly modified), on Question 19, Article 9 of the Prima Pars. Does God will evil? Well, no. But He does will to permit evil. Therein lies the philosophical explanation as to why a completely good will - which is always fulfilled - can exist while evil exists. Even so, Aquinas' explanation in the Summa is not entirely satisfactory. There's something slightly off about how quickly he deals with the active and permissive will of God. But, then, our understanding of God is limited by our human way of thinking which can never adequately capture God's reality and being (don't go down the path of the Divine Names!).
Article 9: Does God Will Evil?
Since we have established that God’s will is always fulfilled, how can one reconcile evil with the will of God? Aquinas says that the good and the desirable are identical, whereas evil is the opposite. Evil, as such, can never be directly desired since it is the opposite of what is desirable. But evil may be desired indirectly, because “evil has a good attached to it, but this goes with being deprived of another good.” God wills His own goodness above all, but He wills some particular goods more than others. Moral evil “He wills in no way.” He does, however, will in some way physical evil or suffering for the sake of some good. That is, He wills the good of the criminal and will allow the criminal to undergo punishment through the loss of a good (a loss of liberty, etc.), for the sake of the “good attached.” Hence, God cannot be said to will physical evils or suffering in themselves, and moral evils “in no way.” The objections are three in number and worth addressing individually. The objections are, firstly, that God wills for every good to be realized, and that it is good that not only good things exist because from evils, good can follow. But the good that results from evil does not come about directly – the goodness that follows is incidental. Hence, it is not good that evil should exist. The second objector states that evil contrasts with good and contributes to the perfection of the universe. As God wills the perfection of the universe, He wills evil. Again, Aquinas points out that any good that follows from evil is not direct. Hence, it is not good that evil should exist in the universe. The last objector says that since God cannot will contradictories (x and not-x), and His will is always fulfilled, it follows that God does will evil. Aquinas responds here that “’to will evils to come into being’ and ‘to will evils not to come into being’ are not…opposed” as contradictory statements. That is, they both affirm something (to will to do x, and to will to do y) and are not contradictory. Aquinas says that God “neither wills evils to be nor wills evils not to be; he wills to allow them to happen” (that is, God wills to do z). Here, the active and the permissive will of God are distinguished. God actively wills the good and permits evil to happen.
 Thomas Aquinas, Summa Theologica, ed. T. Gilby, trans. Blackfriars vol. 5 (Great Britain: Eyre and Spottiswoode Limited, 1967), 41.