Queer the pitch
(Originally) interfere with or spoil the business of a tradesman or showman. (More recently) spoil the business at hand.
'Queer' has been used as a verb meaning 'to spoil' since the early 19th century. Putting those two together we get the meaning of this little phrase. It was first recorded, in the vernacular speech of 19th century London, in The Swell's Night Guide, 1846:
"Nanty coming it on a pall, or wid cracking to queer a pitch."
Swell's Night Guide wasn't exactly a high-minded publication, in fact it was the Internet porn of its day. The elaborate subtitle of the rag rather gave the game away:
A peep through the great metropolis, under the dominion of nox : displaying the various attractive places of amusement by night. The saloons; the Paphian beauties; the chafing cribes; the introducing houses; the singing and lushing cribs; the comical clubs; fancy ladies and their penchants, &c., &c.
In other words, it was a gentleman's guide that explained where to find prostitutes. The 'pitch' referred to in the above quotation was the regular beat of a 'working girl'.
Travelling showmen and market hawkers also called the place they set out their stalls a 'pitch'. 'Queer the pitch' was frequently used it those circles, and later amongst travelling theatre groups, as meaning 'distract the paying audience from the show'. Directing the public away from one trader's business and towards one's own was an important part of street trading of any sort. There was and still is an established pecking order of positions where a stallholder may 'pitch up' on any site. It is a difficult to explain but none the less established fact that a crowd, when entering an open space through an entrance, will veer to the right. The stallholders whose stalls languish on the left-hand side were likely to try any sort of 'queering' of the right-hand ground to redirect raffic.