I'm reminded of the story of Joseph. It seemed like every time he caught a break, he would be thrown down lower than he was before. But, we know from reading the end of the story that God had a plan for Joseph, and the trials he faced were just God's way of getting Joseph to where He wanted him to be.
God works the same way in our lives. Sometimes we don't understand. Many times we complain that life is unfair. But, what we must always remember is that God is in control of our lives, both the good and the bad. Let Him work with you through your trials so He can get you where He wants you to be--in His perfect will.
But verily God hath heard me; he hath attended to the voice of my prayer. Blessed be God, which hath not turned away my prayer, nor his mercy from me.