This verse does not mean that we are to thank God for bad things and tragedies that come our way. It means that we are to remain joyful no matter what is happening in our lives because we have the Lord, and in Him we shall overcome no matter what the devil is trying to do to us.
The Lord does not want us to thank Him for the bad things that happen to us because He did not send them. He is not the author of evil. We are not to become bitter over life's circumstances, but rather to continue to rejoice in the Lord. It is the will of God for us to rejoice no matter what comes. It is not the will of God to receive evil things as from Him. It is an insult to God to thank Him for accidents, sickness, tragedy, etc. He does not send those things to us, the devil does. We are told to resist the devil, and submit to God. (James 4:7, "Submit yourselves therefore to God. Resist the devil, and he will flee from you.") We are to love and rejoice in the Lord in spite of what the devil tries to do to us.
One of Satan's favorite schemes is to send something bad into someone's life and blame it on God. If he can get people to believe it is from the Lord, he has an easier time convincing them of his next lie, that God has failed them and deserted them. He follows this up with a further lie, "Why go on serving a God who does these kinds of things to you?" Satan's real target is to destroy our faith in God. He just attacks different areas to get at different people. "I will bless the Lord at all times: his praise shall continually be in my mouth. My soul shall make her boast in the Lord: the humble shall hear thereof, and be glad. O magnify the Lord with me, and let us exalt his name together. I sought the Lord, and he heard me, and delivered me from all my fears."
We are to bless God at all times, not just when things go smoothly. We are to bless Him when things go wrong, too. We are to boast in the Lord even when all looks bleak.
God bless you all.