I am a A320 Captain for a UK operator.
Whilst not wanting to discuss cockpit door procedures, I think it should be clear to those reading this thread that it requires a conscious person and a deliberate action of someone inside the flight deck to lock someone out and prevent entry to the flight deck.
If a lone pilot suffered a major medical issue ( heart attack, stroke, etc) the possibility of throwing a switch up instead of down is very real. Not saying this is the case, but I can't say I've ever met an experienced driver that hasn't got switch bit at least once in their career under normal conditions, let alone a person dieing.
It seems like about the time we say something can't happen in aviation, it does.