Stress-driven morphological instability and catastrophic failure of microdevices