Our own @Tammi_Terrell did a ton of research on this issue and found that the original phrase was actually the “whole six yards.” She talked about in this long and critically important thread.
Another thread is also crucial:
the whole nine yards - Comments on Cecil’s Columns/Staff Reports - Straight Dope Message Board
That thread contains dozens of examples and dozens and links, covering just about everything that’s known about early uses of the phrase.
There’s not a chance the phrase comes from any of the usual suspects that are thrown up by the internet. Those threads show that “nine yards” is found in the early 20th century and “six yards” in the 19th. (And yes, all the “three yards” would be found in the 18th century jokes were made.) It’s not even true that ammo belts were nine yards long.