You got the right source with definition #1. That shipworm eats into things (the ship hull). A
broma is played on someone and eats that person a little bit (lets say that the annoyance of the joke eats him, or gets into him, like that worm that eats the wood).
The origin of the word is closer to mockery and deceit, thus implying that a
broma would annoy someone.
Also, the word
abrumar has apparently the same etymology.
1- Agobiar con un peso grave.
2- Producir tedio o hastío.
3- Producir asombro o admiración.
abrumar you can be overloaded by both positive and negative emotions. This reference explains the etymology, but basically, the same way that a ship would be dragged or by the perforations in the hull done by these shipworms (an encumbrance or impediment to sail), a person would be by emotions (something in you that becomes a burden).