Terminal Lucidity
Terminal Lucidity is the term applied to cases of people suddenly becoming lucid just before death.
They are relatively common. Where the brain has been damaged due to dementia, other disease or even physical trauma, there is no medical explanation for the patient suddenly being able to communicate clearly again with their loved ones.
An example is quoted by Haig (2007): the case of a young man dying of lung cancer that had spread to his brain. A brain scan showed the metastasized tumours had not just pushed aside normal brain tissue but destroyed and replaced it. In the days before his death, he lost all ability to speak or move.
According to a nurse and his wife, an hour before he died, he woke up and said goodbye to his family, speaking with them for about five minutes before losing consciousness again and dying.
If consciousness is produced by the brain, there is no explanation. The brain hadn't suddenly recovered, it was further damaged. If the brain acts as a filter, the communication is explained by the brain failing to filter.