I know personally of a few instances of pilots inadvertently carrying a firearm or ammunition through security.
In at least two of the cases, the duffel bag used to carry the weapon to the shooting range was later used as luggage for a trip.
In another case, the gun was placed in a pilot's rolling bag by his wife to keep it away from a visiting child.
I've somehow left a full size Leatherman tool with a large knife blade under a Velcro flap in my pilot case and carried it on several international sectors with customs and security inspections. I vaguely remember using the tool to try to fix a loose handle. Fortunately, the Leatherman went undetected and I found it at home while looking for a whiz wheel for upcoming training.
One of my acquaintances had his legal case resolved by a phone conference between union, TSA and company lawyers in some sort of sealed administrative plea. He paid a $2000 fine as I recall.
Another pilot had a bullet found in the folds of his luggage in an Asian country and his case has yet to be resolved a couple of years later.