Sources close to Kim tell us the reality star is "freaked out" ... because the man she has a restraining order against, Dennis Shaun Bowman, has been recently ranting about her on Twitter and sending messages to Miles and her sister Khloe.
Kim and her lawyer, Shawn Chapman Holley, believe the tweets could be a violation of the restraining order that's already in place against Bowman.
Chapman Holley tells us, "I will be speaking with law enforcement detectives ... to determine whether or not Mr. Bowman's actions are a violation of the order in place restricting Mr. Bowman's conduct toward Ms. Kardashian."
As TMZ previously reported, a judge granted Kardashian's request for a restraining order back in February -- which means dude isn't supposed to have any contact with her until 2013.