It does take sometimes for us to figure out what's going. There is no reason to feel guilty, your baby can't talk yet and say what's bothering him, you can only guess which is sometimes close to impossible. You got it now and that's what's important.
I hope that he feels better soon.