Your point is a good one. But it's hard for the nonspecialist to avoid associating this kind of tax avoidance with the behavior of Enron sometime back.
You're doing the same thing: suggesting that the ethicality of a practice depends on its legal complexity.
You are breaking the law if you do not pay what you owe.
Google is using the various laws of these countries, and treaty agreements, to avoid taxes in one place to pay them at a different (much lower) rate in another.
Google is not breaking the law.
Not saying this is right, but this is the way the law works right now.
I'm probably butchering the term, so: http://en.wikipedia.org/wiki/Social_contract
There is an argument that allowing companies these tax breaks brings jobs to your country instead of somewhere else, and this brings prosperity. Certainly Ireland worked this way in the 90s to get their tech scene started. Locally, cities do this too - X year tax breaks to put your factory here instead of there is a common thing.
Is the social contract satisfied by just the generation of good paying jobs where there were none previously?