In One Piece Chapter 254, Usopp saw someone that fix Going Merry, later in chapter 351, Franky told him that it actually a manifestation of a ship's soul.
Is this based on any real legend?
Yes it is, Klabautermann in One Piece world described as a marine holding an hammer, the real story about Klabautermann is a small sailor in yellow with a tobacco pipe and woolen sailor's cap, and often wearing a caulking hammer. (source)
Klabautermann from German folklore (left) and Klabautermann from One Piece world (right)
A Klabautermann often assists sailors and fishermen on the Baltic and North Sea in their duties, and he is known to be an expert of understanding most watercraft.
When Usopp first meeting with Klabautermann, he was fixing Going Merry and revert it to its original shape, not to the flying model when Going Merry got damaged.
Despite the positive attributes, there is one omen associated with his presence: no member of a ship blessed by his presence shall ever set eyes on him. He only ever becomes visible to the crew of a doomed ship.
Usopp saw Merry's spirit when it was already heavily damage, and the boat was beyond repair.
Soon enough, the boat sinking, and the spirit say goodbye to Luffy's crew.