new top- every car is going to need one some day... might as well get it out of the way now. $500
timing belt- See Above, $300
throwing 3 codes- a little of a gamble here but I would be surprised if it took more than $500 to fix
needs brakes pretty soon- Pads and rotors all the way around will run under $200, but you are going to replace them regardless of the condition as you will want a performance pad so you can hardly consider this a cost unique to this car.
So, you are left with a 2000 Miata with 140k miles, new top, new brakes, timing belt done, and likely a new CAT and O2 sensor, all for around $4000. Sounds like a smokin deal to me.