Workaround + speculative fix for messed-up db revision tree

* -winningRevIDOfDocNumericID: now signals a SQLite error with an outStatus parameter.
  Before it would just return nil, just as though the doc had no revisions. This might have
  been what caused the situation in #509 to occur.
* If an added rev turns out to already exist, clear the parent rev's 'current' flag just to be
  sure. This helps fix #509 by correcting the broken rev tree.

Fixes #509 (I think)