Sorry, but as it has been stated, your math is a bit off here because of one reason: the game does not only have physical attacks. Let's just do the math for both attack types:
Maximizing HP will increase them from 277 (you forgot the IV here) to 340, giving Gardevoir a 23% increase in both physical AND special bulk. Putting all EV in physical defense will increase it from 166 to 229, giving it a 35% increase in physical BUT 0% increase in special bulk.
So in other words if you maximize defense over hp, you are trading 23% special bulk for an additional 10% physical bulk (123% physical bulk vs. 135% physical bulk is only a 10% increase). The thing is, that little additional physical bulk is incredibly situational and will only pay off if you're dealt a very specific amount of damage (like in your example). If the damage is slightly higher, the defense won't safe you, if it's slightly lower, then the hp investment would've saved you just as well.
And for that you trade of a pretty sizeable boost in special bulk that will simply come into place way more often than the little physical boost.
So yeah, it is always better to boost hp over defense unless your hp is so big that you won't get enough results out of it. For example Wailord gains only 12,5% more physical and special bulk from a full 252 ev investment into hp, but a massive 25% more bulk in any defense if it puts 128 in them, meaning it is better to put 128 ev into both defenses than putting 252 ev into hp.