Obviously, I do not know the answer. The Bible does not answer this question and neither can science answer this question. However, we can use common sense to try to answer the question.
There are plenty of examples of people whose heart has stopped for a few minutes, yet who were still alive. Common sense tends to tell us that our selves are more strongly associated with our brains than with our hearts. So, common sense says that when our souls no longer occupy the bodies they are part of now, it will be when our brains, not our hearts stop functioning. But, please remember, I am speaking without any source of authority except what I am calling common sense.
But let me use an example to somewhat “prove” what I am saying. It comes from the reality of heart transplants. No one believes that when a heart is transplanted the person whose heart was donated is now the person in the recipient’s body. Our selves are not associated with our hearts. If our selves are associated with any part of us, it surely will be with our brains.