Inflammation in and of itself is not the bodies defence mechanism, but a consequence of the activation of the bodies immune response.
The body has a hair trigger immune system, which when working correctly immediately tags an invader, and floods the local area with prostaglandins, white cells, immune complexes etc, all of whom call up yet more of the same. This accumulation of material, in essence, is what causes the inflammation, swelling, redness, fever, soreness etc. In an acute response to for example a bacterial infection, this inflammation will naturally subside.
In other cases though, the immune response is triggered, and is not "switched off"...... as in say arthritis, for example.
It is in these circumstances that anti - inflammatory drugs (NSAIDS etc) are of most benefit.
In those circumstances where such drugs as Ibuprofen or Aspirin are being taken for pain relief (headache etc), the dose and duration of the drugs are very unlikely to significantly impair the bodies immune response system.