I have taken the subway after midnight many, many, many times in the past four years I've lived in New York -- and I have always felt perfectly safe.
When I was at Columbia, the uptown 1 train was always packed around 2-3am with us college kids coming home after going out ; since the trains only come once every 20 minutes, they can be more crowded than during rush hour !
Obviously it all depends on which train you're on and in which neighborhood, but in my experience (living on the Upper upper west/Morningside Heights, and, now on the Lower East Side), I've never encountered any (safety related) problems whatsoever on the subway at any hour. That said, I have to admit that I'd rather catch a cab after going out just because I don't want to wait around for a train for what could be 20 minutes !