I have other things going on right now, so go ahead and try that other GameShark code you mentioned yourself. However, no, the Infinite Health cheat does not protect Mario from temperature damages for some reason.
The Unlimited Energy cheat protects Mario, but not against temperature damages (ex. the lava). Go ahead and try that other cheat you metioned, though, as I have other things going on right now and won't take the time to test it out.
*Edit: Goddamnit. I really hate the way this website is flowing on my PC. I click Reply, I get a Page Cannot be Displayed. I refresh, it displays, I submit the message, it doesn't show up. Then I reply again, and after waiting five minutes for it to load the page, as usualy with every link I click on in this site, both replies show up. Wireless sucks ass.