How about 1903's smash hit "The Great Train Robbery", directed and photographed by Edwin S. Porter - a former Thomas Edison cameraman? It was the first of the narrative films and ends with a perfectly gratuitous scene of a bandit firing a revolver right at the audience.