I wrote a letter and saved it at the post office, then I made a pattern and saved it at Able Sisters. I then spoke to all my villagers. After that, I made a RAM dump:
My town ID is 1DB0. B0 = red station, so I changed it to 02 for a blue station. As I said in my original post, the town ID appears to always precede your town name. Just replacing all instances of 1DB0 with 1D02 (or worse, all instances of B0 with 02) would mean some unrelated bytes could get changed in the process. We don't want that, so I copied everything from 0x5C738 to 0x5C749 (the end of my town name):
I then replaced the bytes, like so:
The underlined byte is the only one I changed, but as I said, I did it this way to ensure no unrelated instances of 1DB0 would get changed in the process. 88 instances (the number of instances will vary from game to game) of 1DB0 followed by my town name were replaced.
I then injected the modified file. My station changed to blue, but more importantly: all of my villagers continued to recognize me (or rather, recognized that we had last spoken earlier that day), and I could send mail. As I thought would be the case, the game no longer recognized the letter I stored as being composed in my town, nor did it recognize the pattern I stored as being of my creation (although I could place them in my inventory, I couldn't send the letter or edit the pattern). The way to fix this would be by dumping the RAM after moving old letters/patterns into the inventory, and replacing the old ID (in my case, 1DB0) appended to them with the new ID (in my case, 1D02). It'd be a hassle to do each time, but at least it's possible.
With that being said, it should be safe to modify your town ID in order to change the color of your town hall/station, as long as you update all other instances of the ID as well. However, any stored mail or patterns you have will retain the old town ID, as it isn't part of the RAM we're dumping. Similarly, villagers who moved to someone else's town from yours would retain your old town ID (however, they should still recognize you as long as your character's ID and name are the same. They just wouldn't know their origin town was the same as yours, I think). There may be more scenarios like this, but for now, these are the only ones that have crossed my mind.