The correct answer to this is when the brain stops which is normally 3 or 4 minutes after the heart stops.
During my 5 years as a medic, I had to pronounce quite a few people dead when no doctor was present. Normally the procedure was that if they were dead on the scene you did your final checks then noted the time.
If a person died in your presence, you gave them a few minutes before doing final checks then noted the time.
The reason it is the brain and not the heart is simple, because you can restart a heart. Think back to first aid lessons, someone has no breaths and no pulse, means their heart has stopped so you apply cpr. Someone can be brought back to life with cpr or at least it can keep the heart pumping to feed the brain till they get proper medical attention.
If the brain stops, the cells start to die pretty rapidly which is why it is still possible to bring somone back after being braindead but they tend to be in a vegetative state due to the damage done to the brain. There are not that many occurences of people being brought back from braindead as there are heart stopping which is why death is measured on the brain rather than the heart.
I had one instance in a hospital with a woman who had just passed away peacefully infront of us. After passing, we gave it a minute before doing preliminary checks to check if the heart had stopped, it had so we left her in the room for about 5 minutes while we prepared the paperwork and waited for braindeath do occur.
5 minutes later we went back in to perform checks again and pronounce her but half way through this she sat up and screamed. It was a true sphincter opening moment which I think made everybody jump.
She stopped breathing 5 minutes later and 5 minutes after that we wet back, did our checks and prounounced her dead. Had we pronounced her when her heart stopped the first time we would have been 15 minutes out.