I think that in real life what is shown in the film would be impossible.
However, it could perhaps be possible to hit a target behind an obstruction as long as the sideways velocity of the gun at the time of firing (and so that of the bullet) was high enough. That is, ignoring air resistance and how the bullet will slow down in various ways, a bullet could be made to travel in a sort of diagonal. Also the target would have to be a considerable distance behind the obstruction due to the fact that the horizontal velocity involved would be assumed to be much lower than that of a bullet.
If a gun was fired perpendicularly out of the side of a train doing 50ms-1 at a target 200m away and the bullet's velocity was e.g. 900ms-1. The bullet if fired from the train standing still would take about 0.22 seconds to reach the target and so with the train moving, the bullet will travel around 11m horizontally by the time it becomes level with the target. This means that at a certain point, the gun would not have to aim directly at the target but 11m to the side of it. Therefore, the target could be directly obstucted by a reasonably thin object but the target could still be hit. Obviously, this would be unlikely to work as air resistance and wind would have to be factored in with the air resistance from the wind from moving at the speed of the train probably counteracting much of or reversing the bullet's horizontal movement and meaning that you would have to actually aim at the opposite side of the target to that proposed above.
Bullets can follow curved paths in reality, in situations where there is a strong wind over a long distance. Also when looking at footage of World War II fighter planes shooting while changing direction, the bullet trails can be seen to curve (I think, although as the plane swings round the bullets move out of view anyway and that would happen even if they just travelled in straight lines).
In terms of swinging a gun round by hand though, I doubt that any sufficient horizontal velocity could be put on the bullet to cause it to move any useful distance sideways and there would be the problems regarding actually aiming while swinging your arm. Really, there seem to be too many factors involved to make such a thing possible.
Just a note that curving of cylindrical bullets (that only spin on their circular axis) would be different to curving of spherical balls as with the balls it is the Bernoulli effect that causes them to curve as a result of how they are spinning and the effects that has on the air going past them.