I saw this phrase in the book MySQL: The Complete Reference as the title of a paragraph. Though my reading is related to something like system design of MySQL server that also includes the word thread, I think it is somehow related to regular everyday English. I have googled for this but I can't find anything definite and reliable.
I was somewhat surprised to see that the expression doesn't appear in The American Heritage Dictionary of Idioms, second edition (2013). As an idiom, it is at least 76 years old and is fairly frequently used in U.S. sports reporting—especially U.S. football, basketball, and hockey—to describe passing the ball or puck to a teammate through a very small available space. For example, from Fred Stabley, The Spartans: Michigan State Football (1988) [combined snippets]:
Moments later Pingel threaded the needle on a pass and hit Nelson's bushel-basket hands amid a swarm of defenders inside the Michigan 40. On the next play. the fourth after the kickoff, John faded to midfield, spotted Nelson deep in Michigan territory , and fired. Ole caught the ball with an heroic leap at about the 25 yard line and ran it home for the winning score.
The earliest match in the publishing databases I consulted, however, was from golf. From "Patty Berg Loses to Betty Jameson in T-M Finals" in the [Urbana, Illinois] Daily Illini (June 16, 1940):
The match see-sawed back and forth all day and Betty, a tough customer in match play when her putter is working, was pretty downhearted coming up to the fifteenth [hole], one down.
But here she cracked in the most spectacular shot of the day—a chip-in from a foot off the green. She aimed for nearly two minutes then threaded the needle for a birdie three on the 35-yard hole.
And the earliest match for the phrase in the context of U.S. football is from the Sweetwater [Texas] Reporter (October 14, 1942):
Surprise package at the University of Texas this season is Johnny Petrovich, Alhambra, California, prep school star who came to Texas after much hubbub in coast circles. He failed to impress spectators his freshman year, but is "threading the needle" with passes and is currently running No. 1 relief role to Roy McKay as Texas fullback.
More generally, the phrase is sometimes used in a similar (but nonsporting) contexting to signify slipping through a narrow space. For example, from J. Robert King, Lancelot Du Lethe (2003):
Lancelot only nodded grimly, looking around at the steep valley. Sea-battered cliffs bunched on either side of the passage. The ship threaded the needle. Dead ahead, the valley widened just enough to allow a small harbor. Two large ships waited there—one a dragon ship—and numerous small boats as well. Gulls wheeled in shrieking flocks above.
And from Rochelle Schweizer, She's the Boss: The Disturbing Truth About Nancy Pelosi (2010):
The Pelosi-backed bill [which became the Affordable Care Act] was shoved through, with 176 Republicans voting nay and one lone member of the GOP, Louisiana congressman Anh "Joseph" Cao, in support of the legislation.
Regardless, Pelosi's supporters were quick to praise their leader. Representative Jim McGovern (D-MA) said, "[Pelosi] really threaded the needle on this one." And California ally Congressman George Miller, one of the bill's engineers, claimed, "This is our moment to revolutionize health care in this country."
And from Jessica Adams, Wounds of Returning: Race, Memory, and Property on the Postslavery Plantation (2012):
At last riders burst through the gates. The Angola [Prison Farm] Rough Riders, the inmate drill team, sketched cloverleaf patterns and threaded the needle at a full gallop. Then prison officials, professional barrel racers, and local residents on horseback circled the arena to the rousing music of the band.
In the context of your MySQL example, I would guess that the idiom "thread the needle" is being used in the sense of "perform a tricky or difficult task correctly and successfully."