A Management Failure, Not an Employee One

Unless someone is unethical there is not a proper situation where someone is surprised to be fired. Leading up to being fired the individual should be informed of their deficiencies, coached, and remedial goals set.

A good manager cares about the success of their people and if people are being surprise fired then that speaks to the leadership deficiencies in management.

What it costs you inside the company

Organizations who surprise fire people will suffer from morale and retention issues because employees do not feel two-way loyalty.

Performers the company wishes to retain will feel uneasy and always watching for secondary options should they encounter a firing ambush. It's always better to leave on one's own timing, than the timing of others.

And what it costs you in the market

Furthermore, companies who have a habit of suddenly terminating employees will experience whatever negative perceptions the employee may have percolating into the broader industry. Whether there is truth to a former employee's complaints or not, it doesn't matter. Guard your reputation by striving to part well with your fellow humans.

Questions, answered

The short version.

Is a surprise firing ever appropriate?
Outside of unethical conduct, no. Before a termination the person should have been informed of their deficiencies, coached, and given remedial goals. A surprise points at a management failure.
What does surprise firing cost you?
Morale and retention inside, because loyalty stops looking mutual and your best performers start watching for options. Outside, whatever the former employee believes percolates into the industry.