The Lord is the source of all wisdom. We are to be appreciative for whatever gifts that He has bestowed to us (Matthew 7:11). Every gift or blessing that we have originates from Him. This reality is called divine providence. We are not to approach life in a secular way that fails to take into account the workings of God.
We should thank God for holding us up spiritually during times of pain and suffering. He is working things out for the good of those who love Him. He is working things out according to His divine will. If we refuse to give thanks to God, then already existing bitterness will fester in our minds and so rob us of the supernatural peace that surpasses all understanding (Philippians 4:4-8).