It should be pointed out that the quote is not actually by Aquinas.
Here's a translation of the relevant text in De Regimine Principum (On the Government of Rulers):
Thus, Augustine says that a whore acts in the world as the bilge in a ship or the sewer in a palace: "Remove the sewer, and you will fill the palace with a stench." Similarly, concerning the bilge, he says: "Take away whores from the world, and you will fill it with sodomy." [Book 4, Chapter 14]
As you can see, the passage is quoting (or more accurately, paraphrasing) Augustine.
And though the book was often included in Aquinas's collected works, only perhaps Book 1 and the first four chapters of Book 2 are by Aquinas. The rest of the work was probably written by Ptolemy of Lucca. The latter parts even mention the crowning of Albert I of Habsburg, an event which did not occur until 1298, twenty-four years after Aquinas's death.
And the quote we are talking about comes from Book 4, which is part of the work definitely not written by Aquinas.
Source:
Blythe, James M., trans. On the Government of Rulers: De Regimine Principum, by Ptolemy of Lucca, with portions attributed to Thomas Aquinas. The Middle Ages Series. Philadelphia: University of Pennsylvania Press, 1997.