The American analog to “Bob's your uncle.” Though it does have some sexual overtones, it is typically more general, to denote an assured success.

There are two theories on its origin. The most common view is that it is an allusion to Errol Flynn. Flynn was known to live hard—drinking, drugs, and sex. In 1942, he was charged with statutory rape. The trial was the OJ of its day. He was acquitted, but remained at once the butt of jokes, and the subject of a renewed surge of popularity. Having gotten off the charges, the phrase gained momentum.

Many disagree. After all, this took place in the fourties—prior to the sexual revolution. Could this have entered the popular vernacular?

A New York City political boss Edward J. Flynn, who later became Democratic Campaign Manager during FDR’s presidency, had a reputation for getting his candidates elected. It was said that his candidates were automatically “in.” The rhyming slang got a toehold in the Bronx, spread throughout New York, and, with young men going off to war, spread throughout the country.

Though this seems quite plausible, there is a lack of a recorded use prior to 1942. So, there is some doubt to the latter interpretation. Cecil Adams’s column on the subject includes letters by people in New York at the time who favor the Errol Flynn interpretation

Though it seems less murky than the whole nine yards, there will likely never be a true resolution.

Sources:
Word Wide Words: http://www.worldwidewords.org/qa/qa-inl1.htm
Straight Dope: http://www.straightdope.com/classics/a5_156.html