The best way is to plug the PSU to the computer first and in the wall after, you will not damage the connector inside the computer, you already saw what append the other way around, a spark.
edit: to unplug the wall outlet first and the computer after.