Absolutely! In fact, I think it's a good thing to be able to be grateful for the bad since that likely means that you are pulling something good form a bad situation. Bad things can often teach us lessons to hold onto forever and it's good to be able to pick those out rather than dwelling on the terrible position you're in.
I think that there are no bad or good things, there are Just things, what changes it's the frame, how se perceive It. So yes, there could be "bad" things that i'm grateful for.