Ozzy Osbourne put his sick-ass Ferrari in mortal danger yesterday -- TMZ has learned the Prince of Darkness rear-ended another car in L.A. ... and then looked confused about it.

Law enforcement sources tell TMZ, it all went down yesterday morning -- Ozzy's Ferrari hit a Mercedes from behind right before entering an L.A. highway.

We're told both parties waited for police to arrive and then traded information -- departing without incident. There were no injuries and damage was minor.