In Melochim there is a famous occurance of the Eliyahu Hanavi reviving the Dead Child of Ovadiah's Hanavi's widow's child who some say was Yonah Hanavi. If Eliyahu was a Cohen how was he allowed to be in the room with him or carry him up to the attic room to perform the Techias Hameisim (revival of the dead)?
In :בבא מציעא דף קיד Tosafot comments on "אמר ליה לאו כהן". He says:
Tosafot raises the question of how Eliyahu could bring the child of the widow back to life if he was a Cohen? The implication being that since the child is dead, the child would be טמא, and prohibited for a Cohen to come into contact with.
Tosafot answers this question by suggesting that it was clear to Eliyahu that he could bring him back to life, so it would be permitted because of פיקוח נפש (saving a life).
Tosafot is raising the question and provides an answer to your question. For those who are just looking for a source, this is a source. However, I do have some questions on this Tosafot that I believe will lead to a clearer understanding of Tosafot. But it is an interpretation of how to understand Tosafot.
Tosafot seems difficult because if in fact the child is dead then how will the principle of פיקוח נפש help? The child is dead!
If on the other hand the child was in fact still alive, then there is no problem for the Cohen to be in contact with a live child? The child wouldn’t be טמא. Either way you go, Tosafot seems difficult to understand. What is the premise he is operating with? Was the child dead or alive?
Perhaps an approach I heard to answer this question revolves on two different definitions of מתה, death. You could define מתה from the perspective of פיקוח נפש or you could define מתה from the perspective of the laws of טומאה.
The question of death by פיקוח נפש revolves around the issue of whether the person could be revived. If the person is capable of being revived then פיקוח נפש applies. It is the revive-ability that determines the status of the person. This would be determined by the expert. In the case at hand, Eliyahu was the expert that made the determination. He knew that שהיה ברור לו שיחייהו it was clear that he could revive the child.
However, by Tumah and Tahara the question of death would follow a different criteria. The definition would be based on certain objective criteria. The definition is concrete and objectified. This would not be determined based on Eliyahu’s expertise through prophecy or what not. It is a Halachik שם, status, that applies under certain conditions. In the case of the child and Eliyahu, Tosafot presumes the child met the criteria for being טמא. This would be regardless of the child’s ability to be revived.
So in conclusion, the child met the criteria for being טמא while simultaneously meeting the requirements for פקוח נפש. Since in Halacha פקוח נפש allows one to violate the Torah (except for idol worship, murder, certain sexual prohibitions) to save a life, Eliyahu could become טמא in order to save the child.
The Gemara (Niddah 70b) records "three nonsensical questions" (שלשה דברי בורות) that the Alexandrians asked R' Yehoshua. One of them was, "Would the son of the woman from Shunem [who was revived by Elisha, II Kings ch. 4] cause impurity?" He replied, "A dead person causes impurity, not a living one."
The Lubavitcher Rebbe zt"l analyzed this question and answer, along with the other two in that group, which also were related to questions of corpse tum'ah (Reshimos #129; Likkutei Sichos, vol. 18, pp. 239ff). He points out that they didn't ask about the earlier case of the son of the woman from Tzorfas (the one whom Eliyahu revived), because in that case it was his own original life-force that was returned to him. (This is implied in Eliyahu's plea to Hashem, "תשב נא נפש הילד הזה על קרבו" - "let the soul of this boy return into him.") By contrast, the boy whom Elisha revived actually received a new infusion of life from Elisha (Zohar II:44b). So they knew that the boy from Tzorfas, in retrospect, couldn't be considered "dead"; their question, basically, was whether the permanent replacement of one soul by another (as in the case of the boy from Shunem) could counteract the earlier cessation of life that triggers corpse tum'ah. (R' Yehoshua's reply was that it really doesn't matter; the fact that he's now alive automatically disposes of any possible tum'ah. This, indeed, the Rebbe says, is why the Gemara characterizes their question as "nonsensical": it turns out to be based on a flawed premise.)
According to this approach, then, there's no room to consider Yonah as ever having been dead - hence no question about Eliyahu's being allowed to be in the same room as he. (This makes it exactly analogous to the case of the doctor that I mentioned in the comment to Avi's answer.)
Perhaps Eliyahu is not Pinchas. However, Chazal are trying to indicate that there is a similarity in the personality and perfection of both of them. Eliyahu exemplifies a quality of Pinchas.
The Ibn Ezra says explicitly that Eliyahu is not Pinchas in Sefer Bamidbar, Pasrshas Pinchas, Perek 25, Verse 13:
A Cohen may come into contact with a dead person in order to save a life (pikach nefesh), especially if he is the only one capable of doing so.