This is specifically addressed in the Presidental Succession Act (US Code Title 3, Chapter 1, § 19) (emphasis mine)
(c) An individual acting as President under subsection (a) or subsection (b) of this section shall continue to act until the expiration of the then current Presidential term, except that— ...
- (2) if his discharge of the powers and duties of the office is founded in whole or in part on the inability of the President or Vice President, then he shall act only until the removal of the disability of one of such individuals.
(1) If, by reason of death, resignation, removal from office, inability, or failure to qualify, there is no President pro tempore to act as President under subsection (b) of this section, then the officer of the United States who is highest on the following list, and who is not under disability to discharge the powers and duties of the office of President shall act as President: [list snipped]
(2) An individual acting as President under this subsection shall continue so to do until the expiration of the then current Presidential term, but not after a qualified and prior-entitled individual is able to act, except that the removal of the disability of an individual higher on the list contained in paragraph (1) of this subsection or the ability to qualify on the part of an individual higher on such list shall not terminate his service.
So, in other words:
- The President and Vice-President can take the office from any Acting President, whether they were presumed dead and found to be alive, or simply temporarily disabled.
- A Speaker or President pro tempore of the Senate can bump a Cabinet member out of the office by taking office, being found alive, recovering from disability, or simply becoming old enough to be President.
- A Cabinet member may or may not be able to take the office of Acting President from another Cabinet member, depending on the specific circumstances. The language there is unclear, although the intent seems to be to prevent it.
It is worth noting that none of these provisions have ever been used or tested in court. It's possible that if an event happened such that they were needed, a Cabinet member who was presumed dead (and thus passed over) may try to argue that "presumed dead" is not a disability or failure to qualify in the sense of (d)(2), and that they should replace the current Acting President. At that point, they would have standing to sue the current officeholder, and the courts could decide which one will hold the office, whether it's a political question that courts can't address, or whether the whole act is unconstiutional.