|Oh | O|
1. Use O when it has a strong connection with the words that follow (i.e. when there is no comma after it).
O mighty motor-mouthed one….
2. Use Oh when it is an independent exclamatory utterance (i.e. when there is a comma or exclamation mark after it).
Oh, what a bunch of twaddle!
Quotation - "The present tendency is to restrict Oh to places where it has a certain independence and to prefer O where it is proclitic or leans forward upon what follows."
(Source: Fowler's Modern English Usage s.v. "O and Oh")