The computer programmer in me says both are valid:
"on accident" is a pre-prepared behavior that will be employed when an accident occurs in the future.
"by accident" is metadata accompanying an event, reporting the author or agent that created the event.