If you had heart failure, why not head back to the US first? Figure out Thailand later when your health isn’t in any danger.
I know this probably isnt the answer you want, but with a major medical emergency like that and having no contacts or employment here, I personally would want to head home first since you cannot live in Thailand dead.
With the extension, you do the 90 day reporting. If you lose your job, you have to cancel your extension of stay. Do you have to apply for an ED visa outside of the country? If so, then you would have to leave. When you cancel your extension, you can get some time to leave maybe a week. I am not sure. I was granted 3 extra days.
When you come into the country for work, you get a 90 day business visa. Afterwards, you would either have to leave and get a new visa or do the paper work for an extension of stay.
If you are teaching, I would guess you would eventually transfer to an extension of stay instead of going in and out to pick up a new visa. If you lose your job, your work permit gets cancelled and you have to go cancel your extension of stay.
I was able to work and be on payroll, with 90 day business visa, while my WP was processing. I don’t know if this makes a difference, but I am not a teacher.