There is also a Grimm tale about three fleeing soldiers, which I have always associated with the three galavanting Army surgeons who make a deal with the Devil…and a whale is referred to in it as part of the riddle they need to solve to escape their servitude to him (a whale’s rib shall be your silver spoon”).
That fairy tale is called the Devil and His Grandmother.