Subway knew Jared Fogle was a pedophile more than a decade before he was arrested ... so claims his ex-wife in a new lawsuit.
Kathleen McLaughlin says in new legal docs -- obtained by TMZ -- back in 2004, a senior exec at Subway received a complaint that Fogle had approached a young girl at a Vegas promotional event and solicited a sex act.
The lawsuit claims the company received at least 2 other complaints over the years.
As for why Kathleen is suing ... she says Subway made a decision in 2015 to market Jared as a family man, using her and their 2 children's likeness in an animated commercial ... knowing that there was a cloud over him.
Kathleen claims the ad -- which aired 2,309 times -- has caused her and the kids great damage.
She also says had Subway reported Jared back in 2004, she never would have tied the knot in 2010.
We reached out to Subway ... so far no word back.