I think that the source of the idea of vanilla as bland and neutral is the expression "plain vanilla"—signifying vanilla as the primary flavoring (of a pudding, ice cream, cake batter, or other dessert). One of the first recorded instances where "plain vanilla' is used in this sense is in Nell Nelson, "Bun's Garden Party," in the [New York] Evening World (July 3, 1890):
Use pitted cherries, red currants and bits of apple, apricot, pineapple, apple and melon. Candied fruits are very nice and half a pound will fairly gem a three gallon can of cream and convert plain vanilla into Neapolitan, EVENING WORLD, Sick Baby cream or any other title you care to bestow.
For some reason "Sick Baby cream" never caught on—but "plain vanilla" as an undistinguished dessert base did. Another early instance of "plain vanilla" recommends using the psychology of food coloring to jazz up simple desserts. From "Red Sugar and Some Ways to Use It," in the [Sydney, New South Wales] Australian Town and Country Journal (November 10, 1900):
Ice-cream also is much more attractive if varied occasionally in appearance, and the first time it is served tinted to a dainty shade of pink there will be a general inquiry as to what gives the peculiarly delicious flavor. Imagination will naturally suspect the presence of strawberries; raspberries, or other fruit. In reality, a small portion of red sugar was the only addition to the plain vanilla cream, the flavor, however, seeming exceptionally fine.
So white is a problem and vanilla is a problem—and the way forward is to introduce additional colors and flavors.
[[UPDATE (June 25, 2018): Ace researcher RaceYouAnytime has found an even earlier instance of "plain vanilla" (actually, "vanilla plain"), with the implication of simplicity and purity made explicit. From "Woman's Pet Tipple," in the Fort Worth [Texas] Daily Gazette (August 31, 1887):
You see, it's this way: The school girls all want strawberry and vanilla mixed, and the dark ones coffee or chocolate, and the blondes they take pineapple or lemon, and the old ladies call for sars'p'rilla, 'cause it’s cooling to the blood, and the girls who come in with fellows want 'just vanilla plain'—kind of innocent and simple, and the young widows always ask for Vichy, with 'a touch of lemon.'
The source of these insights is a waitress who works at a soda fountain.]]
As the website quoted in lbf's answer observes, one early figurative use of "plain vanilla" is in "Willkie Evolves a Plain Vanilla Foreign Policy for Republicans," in Life magazine (October 19, 1942), which, aside from its title, offers this figurative passage:
Whether rightly or wrongly, many a Republican Congressman voted a straight isolationist ticket before Pearl Harbor chiefly because he could not see a realistic solution to the international problem in any statement from the New Deal. The able Congressman John Vorys of Ohio, for instance, while apparently a strict Republican isolationist, has on a number of occasions expressed his open-mindedness toward international solutions, providing only they are real enough to work. And Mr. Willkie's good and generous friend, Congressman Charles Halleck of Indiana, might be another case in point. Certain it is that patriotic Republicans, such as both of these men are, would welcome a plain vanilla Republican solution to the mighty international problem which they must squarely face.
Another early figurative instance again involves political parties, but this time Democrats are "plain vanilla." From "John White Issues Blast at Shivers," in the Sweetwater [Texas] Reporter (January 8, 1954):
The only state official who didn't run on both the Democratic and Republican tickets last fall said Thursday night "cleanly - drawn" political battlelines would separate "a lot of good, plain, vanilla Democrats" from "a few raspberry Republicans."
Agricultural Commissioner John C. White, 29. devoted most of his speech to Tarrant county Democrats to criticism of the Texas' system of cross-filing and political hybrids.
Then comes "plain vanilla" in the sense of "garden-variety" or "dime-a-dozen" athlete. From "Hoot Gibson Proves Grit, Determination Pays Off," in the [Abilene, Texas] Optimist (September 17, 1954):
When February ro[l]led around and spring drills, Herb checked out his uniform and went through some more hard bumps.
After Spring drills were over he was more or less still classified as a plain vanilla scrub.
And again in the context of sports, from "After-Game-Party Held; What a Game And What a Party," in the [Abilene, Texas] Brand (February 28, 1958):
The basketball victory (81–62) played second fiddle to the school spirit displayed by both Midwestern and the Cowboy cheering section.
What would normally have been a plain vanilla game burst into a wide open affair mostly because of the cheering fans.
In short order, "plain vanilla" became a descriptive term for all sorts of inedible things—to the human beings who serve on censoring boards (in the Crosbyton [Texas] Review, August 7, 1958); to theatrical entertainment (in the [Abilene, Texas] Optimist, November 20, 1959); to low-cost automobiles (in the [Fort Hood, Texas] Armored Sentinel, May 27, 1960); to electric ranges (in the Crosbyton [Texas] Review, February 8, 1962); to a shirt color (in the [Denton, Texas] Campus Chat, March 23, 1962); to teachers (in the Tulia [Texas] Herald, April 12, 1962); to everyday people (in the [Denton, Texas] Campus Chat, October 10, 1962); to football formations (in the Crosbyton [Texas] Review, October 11, 1962); to (finally) sex education, although not sex itself (in the [Philadelphia, Pennsylvania] Catholic Standard and Times (June 18, 1965).
The predominance of Texas periodicals in the preceding paragraph is not a sign that Texas was a hothouse of "plain vanilla" idiomatic experimentation; it just underscores how limited other states' accessible post-1920s newspaper databases are. The Portal to Texas History archive is restricted to small-town newspapers and college newspapers—no big metropolitan dailies with their many copyrighted and syndicated stories from wire services and prominent national newspapers—but it still manages to host a respectable amount of relatively recent searchable content.
In any event, it seems unlikely to me that the writers of these various instances from the period 1942–1965 were taking their cue on "plain vanilla" (knowingly or not) from the world of sexual preferences.
As I noted earlier, the original idea of "plain vanilla" was not that it was unappealing in itself, but that it could serve as a base for a multitude of interesting variations through the addition of other ingredients. Inevitably, however, the relative simplicity of "plain vanilla" invited critical dissatisfaction based on the predictability and unimaginativeness of "plain vanilla." This pejorative element certainly lingers as an overtone of describing something or someone today as "vanilla."