It's happened before: Mel Carnahan was elected US Senator from Missouri almost a month after his death in 2000. 
I looked up 
his Wikipedia page to confirm the year this happened, and discovered there was another case still too: 
Quote:In 2010, Jenny Oropeza died of an illness just a month before voters (posthumously) re-elected her in the Long Beach district during the California State Senate race.