A reader pointed out to me that Psalm 107 contains this really neat parallelism:
The pattern established in four parallelisms (v1-7, v8-14, v15-20, v21-30) is
A - Thank God for all the good things he does.
B - Ungrateful people get into trouble, but...
C - If they humble themselves and repent
D - God delivers them from trouble and brings them to a better place.
In the conclusion, the Psalmist changes it around a little:
v31-32 - Thank God for all the good things he does.
v33-34 - God can turn good things bad.
v35-38 - God can turn bad things good.
v39 - When bad things happen to good people
v40-41 - God turns it around so that all things work to good for those who believe in him.
v42 - Righteous people see this and give thanks to God in all circumstances. Wicked people ought to just keep silence lest things get even worse for them.
v43 - The wise will understand without having to see it in action and will meditate on the enduring love of God.
The same elements are present in the conclusion as in the preceding parallelism, except for one: The ungrateful people who get themselves into trouble. They are there by implication (the princes in v40 and the wicked in v42), but their doubt and foolishness isn't described explicitly.
Maybe the Psalmist's point in leaving that out of the final stanza is that eventually the pattern of sin and restoration comes to an end. The righteous will be permanently elevated and the wicked will come to a permanent end.