Indeed, divine governance, whereby God works in things, does not exclude the working of secondary causes, as we have already shown. Now, it is possible for a defect to happen in an effect, because of a defect in the secondary agent cause, without there being a defect in the primary agent. For example, in the case of the product of a perfectly skilled artisan, some defect may occur because of a defect in his instrument. And again, in the case of a man whose motive power is strong, he may limp as a result of no defect in his bodily power to move, but because of a twist in his leg bone. So, it is possible, in the case of things made and governed by God, for some defect and evil to be found, because of a defect of the secondary agents, even though there be no defect in God Himself.[Summa Contra Gentiles, III-71, 2]
God does not ordinarily govern the world immediately - that is, by directly ordering the course of events. Rather, he normally accomplishes his purposes through secondary causes. This is not unlike the king who does not take the city himself, but who gives orders for it to be done (and then it is done). But secondary causes - like us, for example - are not perfect like God is. We are limited in our powers and gifts and abilities. And we are the pinnacle of the natural world - so how much more are other creatures similarly limited. This does not mean that God's purposes are thwarted because he works them through creatures; rather, his greatness is such that his purposes are fully accomplished even through creation's limitations. But this means that there will necessarily be flaws and defects in creation, because man's knowledge and experience is limited.
But defect and evil are not in creation merely by man's action. For example, mushrooms may only grow in decomposing material. But that means that something must be decomposing - like a tree, for example. But this presupposes the presence of death in creation. Similarly, there are bacteria which feed on decaying matter, and there are trees which depend upon forest fires for the release of their seeds. But this presupposes that there will be fires to release them - and the associated death of many trees. And these fires must be caused somehow - as by lightning, for example. And of course there is the more obvious example of carnivorous animals. How can this be?
Moreover, perfect goodness would not be found in created things unless. there were an order of goodness in them, in the sense that some of them are better than others. Otherwise, all possible grades of goodness would not be realized, nor would any creature be like God by virtue of holding a higher place than another. The highest beauty would be taken away from things, too, if the order of distinct and unequal things were removed. And what is more, multiplicity would be taken away from things if inequality of goodness were removed, since through the differences by which things are distinguished from each other one thing stands out as better than another; for instance, the animate in relation to the inanimate, and the rational in regard to the irrational. And so, if complete equality were present in things, there would be but one created good, which clearly disparages the perfection of the creature. Now, it is a higher grade of goodness for a thing to be good because it cannot fall from goodness; lower than that is the thing which can fall from goodness. So, the perfection of the universe requires both grades of goodness. But it pertains to the providence of the governor to preserve perfection in the things governed, and not to decrease it. Therefore, it does not pertain to divine goodness, entirely to exclude from things the power of falling from the good. But evil is the consequence of this power, because what is able to fall does fall at times. And this defection of the good is evil, as we showed above. Therefore, it does not pertain to divine providence to prohibit evil entirely from things.[ibid., 3]
In other words, a creation with a variety of degrees of goodness and perfections is inherently better than one that lacks this variety. But such a variety means that there will be defects, and events that we would be inclined to call bad. And there is more:
Again, the best thing in any government is to provide for the things governed according to their own mode, for the justice of a regime consists in this. Therefore, as it would be contrary to the rational character of a human regime for men to be prevented by the governor from acting in accord with their own duties—except, perhaps, on occasion, due to the need of the moment-so, too, would it be contrary to the rational character of the divine regime to refuse permission for created things to act according to the mode of their nature. Now, as a result of this fact, that creatures do act in this way, corruption and evil result in things, because, due to the contrariety and incompatibility present in things, one may be a source of corruption for another. Therefore, it does not pertain to divine providence to exclude evil entirely from the things that are governed.[ibid., 4]
One obvious example that comes to mind are things like parasites - leeches, mosquitoes, tapeworms, and other loathsome things. We call them evil, but they are part of the created order. So are diseases. And sometimes, we would not enjoy certain good things apart from evil:
Furthermore, many goods are present in things which would not occur unless there were evils. For instance, there would not be the patience of the just if there were not the malice of their persecutors; there would not be a place for the justice of vindication if there were no offenses; and in the order of nature, there would not be the generation of one thing unless there were the corruption of another. So, if evil were totally excluded from the whole of things by divine providence, a multitude of good things would have to be, sacrificed. And this is as it should be, for the good is stronger in its goodness than evil is in its malice, as is clear from earlier sections. Therefore, evil should not be totally excluded from things by divine providence.[ibid., 6]
And it's not just virtues that we would lack opportunity to exercise without evil. Jack pines would have ceased to exist without fires to release their seeds. Mushrooms (ahh, portobellos!) would not exist without organic matter on which to grow. Dragonflies feed on mosquitoes. Monarch butterfly caterpillars feed on milkweed. These are good things that we only enjoy thanks to things that we are accustomed to consider as evil.
It is in this way, then, that St. Thomas offers a theodicy vindicating the Lord our God.
Now, with these considerations we dispose of the error of those who, because they noticed that evils occur in the world, said that there is no God. Thus, Boethius introduces a certain philosopher who asks: "If God exists, whence comes evil?" [De consolatione philosophiae I, 4]. But it could be argued to the contrary: "If evil exists, God exists." For, there would be no evil if the order of good were taken away, since its privation is evil. But this order would not exist if there were no God.[ibid., 10].
"For as the heavens are exalted above the earth, so are my ways exalted above your ways, and my thoughts above your thoughts" (Isaiah 55:9). I must say, though, that Brussels sprouts are unquestionably a result of the Fall.
(That's a joke, son.)