Consciousness is a truly amazing topic and one I find fascinating. It is difficult to investigate. There have been a number of studies with cardiac arrest patients with mixed results.
I would disagree with the line "We know the brain can't function when the heart stops beating". We know no such thing. It is rare that a patient would be connected to an EEG at the moment of arrest but even that is no true indicator. fMRI isn't really an option to investigate brain function at time of death...yet.
My dad arrested for over 23 minutes with no cardiac output other than wonderful CPR. He suffered no permanent damage. He has no memory of the event. He was also ventilated and sedated for several days. That is another confounder for studying intra arrest awareness....it is not uncommon for patients to require sedation and support post arrest and that can affect memory.