I'm speaking a bit beyond my knowledge, but...

Integrate essentially uses the Risch algorithm, which I understand works for functions, but not distributions. DiracDelta and other things that aren't actually functions can be problematic. Integrate seems to have some functionality though to handle distributions as best as it can. If you'd like, you can forward the example to the technical support team (support@wolfram.com) and suggest that Integrate be extended to handle . It's proably not a bug, but maybe Integrate could be improved.

This is a common surprise for physicists using computer algebra. Another is that the results given don't always seem to be very cooperative (esp with orthogonal functions) :

Integrate[Cos[m x] Cos[n x], {x, -Pi, Pi}]

gives:

(2 m Cos[n \[Pi]] Sin[m \[Pi]] - 2 n Cos[m \[Pi]] Sin[n \[Pi]])/(m^2 - n^2)

Where you'd might expect Pi*DiracDelta[m-n].