I was just reading Surat Al-Ankabut today... Is this the verse about the ship you're talking about?
Now, if they embark on a boat, they call on Allah, making their devotion sincerely (and exclusively) to Him; but when He has delivered them safely to (dry) land, behold, they give a share (of their worship to others)!- (29:65)
EDIT: I just realized you were asking for a Hadith... But maybe the verse I posted will still help.