Gourds are mentioned in the Bible twice, 2 Kings 4:39 and Jonah 4:5-10, but these are not the same plant.
The wild gourds in 2 Kings 4:39 were mistakenly put in a pot with herbs making it to bitter to eat until the prophet Elisha corrected the problem by adding meal. This gourd is in the cucumber family, Cucurbitaceae, the same as pumpkins and squash some of which can cross pollinate with birdhouse gourds resulting in bitter fruits and loss of an heirloom line of seed as is warned in the following verse.
Thou shalt not sow thy vineyard with divers seeds: lest the fruit of thy seed which thou hast sown, and the fruit of thy vineyard, be defiled. Deuteronomy 22:9
The gourd in Jonah was actually a castor bean, Ricinus communis, which is often called mole pea around here because it supposedly deters moles. This deterrent effect may be because it is the source of ricine, which is the most lethal plant toxin, where near the plant the worms or grubs the mole eats either move or die rather than the moles being directly affected by eating the plant itself. Castor bean is the source of castor oil, which is also a component of brake fluid although it has the opposite effect as a purgative. Some people have eaten a castor bean for a hallucinogenic effect, but this will result in a permanent psychosis due to the toxicity where the toxin acts as a catalyst that interrupts metabolism on the molecular level in the mitochondria thus the action is greatest in metabolically active regions such as the brain.