"Jackass" star Ryan Dunn died in a car crash in Pennsylvania early this morning ... TMZ has confirmed with Bam Margera's mother.

34-year-old Dunn appeared in all of the "Jackass" movies -- famously shoving a toy car into his rectum in the first flick back in 2002.

Dunn and an unidentified person both died in the crash which happened around 3 a.m. at Route 322 and New Street in West Goshen Township. It's unclear who was driving the car.

We're told the car caught fire in the crash -- and hours later, a tow truck was called to the scene to remove the charred wreckage.