Psalm 112:10
6 For he will never be shaken; others will always remember one who is just. 7 He does not fear bad news. He is confident; he trusts in the Lord. 8 His resolve is firm; he will not succumb to fear before he looks in triumph on his enemies. 9 He generously gives to the needy; his integrity endures. He will be vindicated and honored. 10 When the wicked see this, they will worry; they will grind their teeth in frustration and melt away. The desire of the wicked will perish.
Matthew 13:42
40 As the poisonous weeds are collected and burned with fire, so it will be at the end of the age. 41 The Son of Man will send his angels, and they will gather from his kingdom everything that causes sin as well as all lawbreakers. 42 They will throw them into the fiery furnace, where there will be weeping and gnashing of teeth. 43 Then the righteous will shine like the sun in the kingdom of their Father. The one who has ears had better listen! 44 “The kingdom of heaven is like a treasure, hidden in a field, that a person found and hid. Then because of joy he went and sold all that he had and bought that field.
Notes and References
"... an even closer parallel to the “gnashing of teeth” texts in the Gospels occurs in Psalm 112:10. In contrast to Psalm 37, which emphasizes the coming judgment, the central theme here is the reward of the upright person. To the one who follows the commands of the Lord, his righteousness will remain forever (112:3). His name will be remembered fondly (112:6), and he will live to see the punishment of his enemies (112:8). Then, “the sinner shall see and be angry, he shall gnash his teeth and waste away; the desire of the sinner shall perish” (112:10). Again in the hebrew of this psalm, Dahood sees a future setting after a resurrection. He suggests that the word ךְֶשֹׁח which is used in 112:4 to describe the darkness, from which the upright will be set free, is not common darkness, but the darkness of death. Indeed, the notion of the righteous living to see the complete destruction of their enemies seems the push the boundaries of this psalm forward, and expresses a hope in a future, permanent restitution ..."
Papaioannou, Kim, and Edward Fudge The Geography of Hell in the Teaching of Jesus (p. 182) Pickwick Publications, 2013