>>212759903He was working at sea so he would have been trained on tides, nautical charts, and currents. Standard methods for estimating the drift of a corpse would also be something a detective in a port city would know where to find. It's a matter of plugging variables into an equation based on things he knew - current, estimated time of death, and the route of the ship. He did not invent a new calculation all by himself, he just looked up standard methods and applied them.
So it's really not that big of a leap. The impressive part was that he sat quietly and did his homework for once, which was out of spite as you said.