Ir seems to have started as an americanism, the earliest recorded use of the phrase being in a publication called Life in Sing Sing. Sing Sing is, of course, the nickname of a famous American prison. The idea behind it there is that the person was caught in the act of some misdeed.
We find the same sense of 'bang' when we use phrases such as 'Bang in the middle' or 'It hit him bang on the nose.' There, too, there is a suggestion that it was exactly right, just as being caught in the act means you cannot possibly deny it.