EXCLUSIVE

Ex-"Shahs of Sunset" star Sammy Younai had a sex contract all drawn up but then got pissed when his mattress got pissed on, and his reaction triggered an extortion investigation.

Sources close to the case tell TMZ ... Sammy was recently dating a woman who wanted rough sex. He emphatically shut it down unless she agreed to put something in writing to protect him from sexual assault claims.

We're told they worked it out over email and went forward. We're also told Sammy pulled out his cell phone and recorded part of the encounter.

Sources tell us after the session the woman peed on his mattress. Sammy was outraged and demanded she pay to replace it. She refused, and that's when Sammy allegedly said if she didn't ante up, some people will learn some stuff about her.

Sources close to Sammy tell us he never demanded money for the mattress and he's never asked for money from anyone he's been with. She went to cops and filed an extortion complaint.