Explosive star death witnessed by Hubble could help develop an early warning system