Read this (scroll down to examples): Differentiation under the integral sign - Wikipedia, the free encyclopedia
The technique was used extensively by Feynman (you can read about that in this book: Amazon.com: Surely You're Joking, Mr. Feynman! (Adventures of a Curious Character): Richard P. Feynman,Ralph Leighton,Edward Hutchings,Albert R. Hibbs: Books)
It can always be used with definite integrals, but will not always be useful. Obviously it was useful in this case.
Scroll down to theorem 9.4 (Fubini's Theorem - Stronger Form): Repeated Integrals and Fubini's Theorem