We agree that the compass on the iPhone is not as reliable as a good hand-held Boy Scout compass (as Casey says). But the GPS in the iPhone4 is very good and one can inexpensively load charts into the iPhone from a Navionics app. In the dense fog, when your chartplotter or boat power goes down and you don't know where you are, all those neat nav instruments of old (including the compass) will probably be of little use - but the iPhone, with its own battery power, independent of the boat systems, shows you where you are on a good chart. With a few other apps, it even tells you if there is commercial traffic nearby (and the boat name) and the tides.
Knowing where you are on a chart, the iPhone compass (or the Boy Scout hand held that we carry) can head you in the right direction for shelter, anchorage, home, or whatever.