Well i presume that, this has todo with the "Bullet" originating, at a specific fixed position, which will then hit the wall, despsite having a line of sight and Line of Fire.
So basically the bullet origin needs to take into account what is the possible Line of Sight and from the Line of Sight, the possible Line of Fire, which do not run into Object.
And fire along this line, you wil still miss probably, because it is a hard shot, especially those angles mentioned, but at least you would have the posibility to hit.
There also some other situations were you are proned to miss. Try hitting a alien behind a 1 level building or UFO, with a soldier from the 2 level.
You wil miss always, even thou you have Line of Sight and can shoot. You will mis no matter what even with 10000% hit chance.