I know this is of no use to the OP at the moment, but I use the HMRC app to provide access codes rather than get them sent by SMS, thereby eliminating this issue. Once you can get logged in via the gateway, it may be worth changing the way you receive the access code. Just a thought...
Fortunately, my DTAC sim can receive the access code via SMS, which I use as a backup.