Answer:
It's very understandable why you are confused; amira l'akum is one of the most difficult parts of Hilchos Shabbos.
The rule you mentioned, not to ask a goy to do anything you may not do yourself is true. However, it is a general rule and has numerous exceptions. First of all hinting in the method you mentioned is permitted because you are not asking the goy to do anything. However, if you would phrase the hint in a way that is more direct such as "if you turn down the flame it would help me", it would be forbidden.
Additionally there is an issue deriving direct benefit from any melacha that was done for you on Shabbos even if done in a permitted fashion. So if you told your neighbor that the room is too dark to read in that would be a permitted hint, but when they turn on the light you would not be allowed to use it and may even have to leave the room. However, in the specific case you mentioned where you want the goy to prevent potential damage rather than create a benefit there is no problem.
I don't see any problem with saying thank you, and of course it's always important to maintain good, polite relations with all neighbors.