Inconsistency in miracles healings and answers to prayer

Why is God so "hit-or-miss" in the way He responds to our petitions for His miraculous intervention? When my son was born with a heart defect and needed open-heart surgery, our prayers were answered miraculously. But when my husband was diagnosed with cancer, his condition deteriorated steadily in spite of the constant intercession of family, friends and our church community. He died after battling the disease for less than a year. I don't understand this. What does it all mean?