Which AI difficulty are you playing? On the higher difficulty levels (anything above Prince), the AI definitely cheats - the main way it cheats is it has lower costs for building things. It doesn't do any kind of sudden extra boost late in the game - I would hate that.
The AI is very complicated, and I've put a lot of work into making it competitive through logic, but like many games the higher levels have to have an advantage to be competitive against humans. I'd love to have non-cheating competitive AI, but it'd have to be human-level smart, and it's just not.
I've also tried to reduce the feeling of sudden loss, with things like showing AI progress on certain buildings, but sometimes the AI's win is still surprising. On advanced levels where they've built up a ton of income, they can pretty quickly progress through the stages of advanced buildings.