Over the years scientists have discovered that many animals feel pain including some "surprises". I put the word "surprises" in quotes because solid evolutionary theory and "good biology" strongly support the notion that a large number of animals should in fact feel pain. For example, fish were long excluded from the "pain club" but we know that they do indeed feel pain and are highly sentient beings (see also).
Now we know that crabs also feel pain. In a recent study by Barry Magee and Robert W. Elwood published in the prestigious peer-reviewed journal The Journal of Experimental Biology called "Shock avoidance by discrimination learning in the shore crab (Carcinus maenas) is consistent with a key criterion for pain" these researchers "allowed shore crabs ... to choose between one of two dark shelters in a brightly lit tank. One shelter came with a mild shock. After just two trials, crabs that initially chose the shocking shelter began opting for the zapless shelter, suggesting they learned to discriminate between the two options and headed for the less painful one." Previous research had shown that "prawns whose antennae were doused with caustic soda vigorously groomed their antennae, as if trying to ameliorate pain. Importantly, this behavior didn't occur if Elwood treated the antennae with an anesthetic first." (my emphasis)