I don't see why it wouldn't be safe, at any hour. CR is not like Colombia where you can't travel by ground transportation. As far as cost, whatever you negotiate, $75??? No idea. Jaco is $60-80, and MA is a bit farther I think. If you use a taxi in the next few days, ask the driver if he'd be willing to take you. If you arrange it one-on-one with a driver you'll get a better deal than calling a taxi service IMO.
There is also a thread of dependable drivers, maybe call a few:
https://costaricaticas.com/phpBB2/viewtopic.php?t=8340
My suggestion would be to come into SJ the afternoon before, get a room somewhere, and enjoy SJ for the evening, then take a cab to the airport at 5am. I'm suggesting this for 2 reasons. SJ has a much better "nightlife" and also too many things can happen on your long drive from MA which can make you miss your flight: a flat tire, car breaks down, an accident on the road creates a traffic jam, a mudslide, aliens, etc.