Every time that he wished to study, to undertake a disputation, to teach, to write, or dictate, [Thomas] first withdrew into prayer on his own and prayed pouring out tears, in order to obtain understanding of the divine mysteries.Among contemporary witnesses the stories abound of Thomas having credited prayer above any intellectual ability of his own as accounting for such theological insights as his work might have provided. No doubt some of those stories are apocryphal in detail, pious conjectures of a stereotypically hagiographical kind. It is equally doubtless that they genuinely reflect the wider reality: Thomas wanted to know, and what Thomas wants he prays for. And if he put his theological insights down as much to the outcome of his pleading in prayer for understanding as to anything else, I can see no reason why we should be skeptical. It is not that Thomas thereby claims any divine warrant for his theological arguments, as if their coming to mind in the course of or as a result of prayer in itself authenticated them, as some writers in his times, and especially in the next century, were wont to claim for their work. Thomas never claims warrant for any of his theological conclusions on the grounds (as a son of mine when three years old once did) that “God told him,” otherwise than by way of appeal to what the Church claims God had told everyone. Thomas hid his prayer as he hid his bulk, and specifically insisted to any of his brethren who witnessed anything out of the ordinary by way of prayer experiences that under no circumstances should they report them to anyone else. What Thomas does know is that some kinds of understanding will come to the theologian only within a life of faith and prayer, as gift given to those who ask for it.
From Thomas Aquinas: a portrait, by Denys Turner. chapter six.