In the case of my great-great-grandfather, it apparently worked. In the town hall in Chęciny, I found his death registration in the 1940 civil register, illustrated above. He lived to age 85, under the Nazi occupation.
But again, make no assumptions — there are cases in which a baby was named Chaim (or Alter, Zayde, etc.) because he or she was named in memory of a deceased relative with that name. (For example, my uncle, born 1945, was named "Alter" in memory of this great-grandfather who died in 1940).