Topher Grace is getting an ominous warning about his KKK role in the new movie, "BlacKkKlansman," and it's serious enough he's had to get police involved ... TMZ has learned.

Topher got a phone call from someone who called him a gay slur, and warned his role was going to ruin race relations in America ... according to our law enforcement sources. If you haven't seen the movie, Topher plays former Ku Klux Klan Grand Wizard David Duke.

We're told Topher described the caller as angry and aggressive. It's unclear how the person tracked down the actor's personal cell phone number.

Our sources say cops took an incident report, and there's a possibility this could develop into a hate crime investigation ... depending on what, if any, specific threat was made against Topher.