As Tushar Raj's answer notes, one traditional way to describe a bad result that at first looks like a blessing is in connection with the warning "Be careful what you wish for" (sometimes completed with the phrase "because it might come true").
A familiar instance of this warning is in the cautionary fable from Aesop of "The Frogs Who Wished for a King." The public domain Aesop for Children tells the fable this way:
The Frogs were tired of governing themselves. They had so much freedom that it had spoiled them, and they did nothing but sit around croaking in a bored manner and wishing for a government that could entertain them with the pomp and display of royalty, and rule them in a way to make them know they were being ruled. No milk and water government for them, they declared. So they sent a petition to Jupiter asking for a king.
Jupiter saw what simple and foolish creatures they were, but to keep them quiet and make them think they had a king he threw down a huge log, which fell into the water with a great splash. The Frogs hid themselves among the reeds and grasses, thinking the new king to be some fearful giant. But they soon discovered how tame and peaceable King Log was. In a short time the younger Frogs were using him for a diving platform, while the older Frogs made him a meeting place, where they complained loudly to Jupiter about the government.
To teach the Frogs a lesson the ruler of the gods now sent a Crane to be king of Frogland. The Crane proved to be a very different sort of king from old King Log. He gobbled up the poor Frogs right and left and they soon saw what fools they had been. In mournful croaks they begged Jupiter to take away the cruel tyrant before they should all be destroyed.
"How now!" cried Jupiter "Are you not yet content? You have what you asked for and so you have only yourselves to blame for your misfortunes."
[Moral:] Be sure you can better your condition before you seek to change.
The moral is the conclusion of the Aesop for Children compilers. An equally valid moral might be "Be careful what you wish for—it might come true."