I think both have different meanings.
son of a gun
Means a tough guy.
Example: In the movie The Avengers when Iron-Man guides the missile into the portal, loses consciousness and the portal was about to close, he comes back to earth falling. At this time, Cap says "Son of a gun.", meaning Iron-Man is a tough guy (Can be interpreted in many other ways but this is mine.).
That lucky bastard
It is different from the above expression. For example, if a guy is dating hottest girl in the school, the other guys might call him "Lucky bastard", meaning he got lucky to date that girl.
In the movie Hachiko, Carl says Hachi a son of a gun because Hachi is tough and waits for his master at the station at the exact time when his master's train arrives.
Moments before that scene there's a conversation like this,
-He's been here all day?
-No... no, he's just rode up 2
minutes ago. He went right there.
-You're kidding. You seen Cate?
-I haven't seen her.
From the conversation, we can say that, Hachi reached station and waiting for the master in time without anyone's help. So, I think that's Carl way of telling Hachi a tough guy.