By 4am on Wednesday, many Democrats looked despondent, with some appearing close to tears.