About 50 million years ago, an insect similar to our modern day "walking sticks" was going about its ancient buggy business when it was startled by something. That insect might just be one of the luckiest in history because when it got scared, it leapt out of its exoskeleton and simultaneously out of the way of glob of tree sap that would have entombed it forever.

Over time, that tree sap formed into amber – a hard fossilized version of the substance – and the drama it contains was just discovered by George Poinar, Jr., an amber expert from Orgegon State University. Poinar says that the bug was not only lucky to have escaped the amber ambush, but it also probably fled from a predator. Both the bug and the predator were likely feeding on a mushroom that's also trapped in the resin.

"From what we can see in this fossil, a tiny mushroom was bitten off, probably by a rodent, at the base of a tree," Poinar said. "An insect, similar to a walking stick, was probably also trying to feed on the mushroom. It appears to have immediately jumped out of its skin and escaped, just as tree sap flowed over the remaining exoskeleton and a hair left behind by the fleeing rodent."

Poinar says that filaments preserved in the exoskeleton point to the fact that it had been recently jettisoned rather than long abandoned, which helps to build the scenario of what happened immediately before the sap descended.

The fossilized resin holding this ancient scene is called Baltic amber, because it comes from areas near the Baltic Sea – where present-day Germany, Poland, Russia and Scandinavia are located. Fifty million years ago, that area was covered by a coniferous forest, although evergreens were just starting to give way to be replaced by flowering plants. Amber deposits in this region are the largest in the world thanks to all the sap that was flowing from those trees.

"The tiny insect in this fossil was a phasmid, one of the kinds of insects that uses its shape to resemble sticks or leaves as a type of camouflage," Poinar said. "It would have shed its skin repeatedly before reaching adulthood, in a short lifespan of a couple months. In this case, the ability to quickly get out of its skin, along with being smart enough to see a problem coming, saved its life."

The insect is now extinct, as is the mushroom in the fossil, which represents a new genus and species, and is the first mushroom to ever be found in Baltic amber.

Poinar has detailed the mushroom discovery in the journal Fungal Biology.