Jailbroken iphone not charging - neither through USB nor through the A/C adapter!
if you still have warranty on it :


  I would suggest you restoring the
  iphone to factory settings and taking
  it to the nearest Apple store.


else :


  I believe there is a hardware issue
  (loose connection). Since it is a 3G
  iPhone (warranty may have expired
  unless you got AppleCare), it is not
  difficult to open up and see whats
  going on inside.


Hope it helps!

p.s : When you say 'stroke of luck', things get interesting. You may put your iPhone in Restore mode and then see if iTunes is recognizing it (if you at least have any charge, only then will it be possible to try this!).