The story
Possibly based on a technique of building wattle and daub walls by throwing daub (mud mixed with straw) at the wattle, throwing hard enough that some obtained a good key and remained in place, (compare slapdash, a pebbledash effect produced by throwing pebbles at a rendered wall). Sense 2 is probably influenced by throw dirt enough, and some will stick.
Etymology from Wiktionary, CC BY-SA 4.0.