I thought they had encountered human traders before. I seem to recall that Cyrano Jones and Mudd both operated in the Klingon sphere.
Just because there is a war on doesn't mean everyone runs out and goes to war.
I thought it made sense that the Klingon Empire was somewhat diverse, like real-world empires tend to be, to the point where a few humans running around on the Klingon capital wouldn't raise suspicion.