Not a software issue, simple hole in upgrade:
1. Take any not-railway artillery unit
2. Move it to your town
3. Upgrade to railroad gun (e.g. 280mm K5)
4. If the town has railroad, everything will be OK
5. If the town has no railroad, unit will be upgraded to railroad gun anyway.
6. And it will stick forever as there's no railway and it can't move out

It seems to me that upgrade to railroad unit in the town with no railroad must be blocked.
Whatever else - great game, can't wait for 1944 campaign!