The phrase ‘(A) boon in disguise' is used for something which is thought to be a misfortune in the beginning but later proves to be beneficial.
1. The pirates captured the ship and left the sailors stranded on a desolated island. However, it proved out to be a boon in disguise for them as the ship soon caught in the storm and sank.
2. My boss reprimanded me that day for coming late to the office; but it proved to be a boon in disguise for me as it made me an early riser.
3. The Chinese attack of India in 1962 turned out to be a boon in disguise as helped India become militarily strong.