"Gosh" is an interjection, and is considered a bit old-fashioned and quite polite.
It can be used to express lots of things, depending on how you say it, but usually it is surprise or delight.
A person's death may well be surprising, if they died young or in some unexpected or unusual manner (a bad accident or murder, for example). If the person died after a long illness and you were expecting the death, you certainly wouldn't say "Gosh".
- For Teachers