Grammatically speaking, ''by accident" is of older use, so one could use it on the safe side (just in case.)
Outside of academical writing, "on accident" is slowly becoming somehow accepted.
Perhaps the confusion has arisen out of comparison/contrast between "on purpuse" vs "by accident", that someone might have morphed into "on purpose" vs "on accident" - my theory, though.
The fact is that "on purpose" (circa 2006) was a 25 y.o. novelty...
Anyway, it´s somehow accepted and I am not the one to say otherwise, but being taught to use "by" I would rather favor that option.
It´s me, though! http://www.inst.at/trans/16Nr/01_4/barratt16.htm