I had the same "shooter shock" that you are likely to get when you compare the accuracy of, say a K38 to a Model 5906 with adjustable sights.
While 1 inch at 25 yards is much more common from a stable position with the K38 (or almost any S&W revolver), the same rested position will give you, at best, 3 to 4 inch groups at 25 yards with almost any "duty auto."
Glocks have such thick sights that it is nearly impossible to get "target grade accuracy" out of them unless you either use a paper target with a bigger bull to suit that fat front sight, or you replace the sights with sights that are are not as unfriendly to classic target shooting, which is not the purpose of that class of firearm. When so modified, it is actually surprising what a Glock is really capable of doing.
That said, all of the current crop of "combat pistols" are shoddy in the accuracy department (when compared to target grade firearms), whether you are talking about the Beretta M9, the Glock 17, the Ruger SR9, the S&W M&P, the Springfield XDM or whatever.
HKs are quite accurate and the HK USP and the HK45 are both surprisingly good with the issue sights.
That said, if accuracy is the most important consideration, get a 1911 or 952 from the S&W Performance Center, a 1911 from the Springfield Custom Shop (not a standard one sent back, but an actual one built and machined in the Springfield Custom Shop) or a Les Baer 1911. The Baer is so tightly fitted that administrative handling in the usual manner is nearly impossible, so be prepared to change the way you check the chamber for loaded condition, etc., else you will find yourself ejecting the round clear across the room when the action finally breaks open, if your hand hasn't slipped already causing either an abrasion or, worse yet, drawn blood.
None of those really accurate choices are exactly what anyone wants for duty, however. You will simply have to get over the shock of crappy groups with a service auto. Remember, group size is not what you want in a combat scenario. At Gunsite, if your groups are too small, you get called out for not going fast enough - target shooting instead of combat shooting. That said, accurate guns are better, all other things being equal.