EXCLUSIVE

Robin Thicke and ex-wife Paula Patton have been embroiled in a nasty custody fight over their 6-year-old son. It's escalated to a Child Services case over alleged physical abuse, and Robin just scored a legal victory.

Sources familiar with the case tell TMZ ... Julian told school officials at the beginning of the year his dad had spanked him ... more than once. The school reported the incident to the L.A. County Dept. of Children and Family Services on January 3rd, and the Dept. opened an investigation.

Paula then began denying Robin access to their son, and filed an emergency order asking the family law judge to restrict Robin's contact with Julian to monitored daytime visits only.

According to legal docs Paula told Robin, "Julian is scared of you."

Paula says in her declaration, the day before Julian told the school, he told her that Robin spanked him "really hard." He demonstrated and hit Paula on the back so hard she said, "ow." Julian then said it was actually worse than that.

A school official also submitted a declaration saying Julian told her Robin frequently "punches" him very hard.

Robin says in legal docs, "On a very rare occasion and only as a last resort, I will use light spanking, but it is consistent with the law -- open hand on the butt. This is the type of discipline to which Paula and I agreed during our marriage."

There's also a declaration from a nanny who claims she has seen Robin smoke marijuana on several occasions in front of Julian. And there's this: Paula says at Julian's kindergarten graduation last June, Robin showed up drunk at 8:30 AM and was "hooting and hollering and making inappropriate jokes" in the Catholic church.

Robin claims this is all about his decision to block Paula from attending his dad Alan's funeral last month. He says in docs, "Paula did not have a positive relationship with my father and often made negative comments to me about my father. As such, she was not welcome at his funeral."

Sources connected to the case tell us there was a hearing Thursday morning and the judge denied Paula's request to limit Robin's joint custody and also a request for drug testing.

As for DCFS, we're told social workers have interviewed Julian twice and also interviewed Paula. Robin is being interviewed Thursday afternoon.