Not so Andy. It does actually come from olden days when medicine was in its infancy and they didn't always get it right when pronouncing someone was dead.
Some people used to have a string attached to a bell topside and someone would sit vigil at the grave for a number of days and nights in case the bell rung. If it did then the grave was quickly opened and the 'dead' person exhumed. Unfortunately sometimes the bell rung because they had been buried before full rigor mortis had taken place and, as the body stiffened, the muscles would contract causing the string to be pulled and hence ring the bell.