One theory that I think plausible is that minding your P's and Q's might mean minding your pints and quarts. Bar owners would push constantly the importance of logging the drinks poured through using a ledger; thus mind your P's and Q's. Then at the end of the day, he could tally the total drinks poured and try and match it up to the money that came in that day. The ledger was difficult to keep up with especially when the bar was crowded.
Then in 1873, a mechanical cash register was invented making the tracking of sales receipts easier. One of the features bar owners wanted on the newly invented cash registers was to have a bell ring every time the cash drawer was opened so the owner could watch the transaction and make sure the money was being transferred properly. Bartenders were notorious for pocketing money back then.
By the way, the first electric cash register was invented in 1906 with many different brands available, but in around ten years, National Cash Register (NCR), owned a 95% share of the market.
So the bottom line is that I believe this theory of where the phrase: "Mind your P's and Q's," is a realistic explanation to where the phrase was generated; of course, I've been wrong before. :)