In the Thurston and Attwater revision of Alban Butler’s Lives of the Saints, the episode is described this way:
On the feast of St. Nicholas [in 1273, Aquinas] was celebrating Mass when he received a revelation that so affected him that he wrote and dictated no more, leaving his great work the Summa Theologiae unfinished. To Brother Reginald’s (his secretary and friend) expostulations he replied, "The end of my labors has come. All that I have written appears to be as so much straw after the things that have been revealed to me." When later asked by Reginald to return to writing, Aquinas said, "I can write no more. I have seen things that make my writings like straw." (www.catholic-forum.com/saintS/stt03002.htm)
Aquinas died three months later while on his way to the ecumenical council of Lyons.
Aquinas’s vision may have been a vision of heaven, compared to which everything else, no matter how glorious, seems worthless. We can only speculate on that point. Scholars, hagiographers, and Catholics in general have never understood Aquinas’s comment to be a retraction or refutation of anything he wrote. If it had been, Pope Leo XIII would not have encouraged a renewed interest in Thomistic theology and philosophy, and Aquinas would not have been named a Doctor of the Church.
It is also reported that Aquinas had another mystical experience in which the voice of Christ said to him, "You have written well of me, Thomas" (www2.nd.edu/Departments//Maritain/etext/thomas1.htm).