It's also an expression of surprise, introduced into the English language by the author Francis Durbridge.
In the days when it was considered to be swearing to say things like 'Damn' or 'Hell', authors struggled to find phrases to express surprise, concern or indignation. (This was particularly true of those whose works appeared on the radio). Francis Durbridge invented the phrase 'By Timothy' for her hero, Steve Temple, to use at dramatic moments. The radio series was listened to by the majority of the population and the contracted 'Timothy' came to be used as an expression of surprise.
Timothy is also the name of a type of grass used for animal fodder.
Chris