Well I hope you didn't replace it with an oem drive,because they ****. Go Western Digital & steer clear of Maxtor/Seagate. However, check some of this first. Go into bios after running for a while & check the cpu temp & board temps out. Anything running at or above 165 farenheit(65 celcius) is in or having a major overheating issue. In that case, a thourough cleaning is needed & a fresh dose of cpu thermal paste put on. While it's open be sure to check that all the fans are working. Some of those optiplex's had 2 cpus so be sure to apply new thermal paste to both,remember to wipe off the old stuff first. If the steps above don't help with the existing drive, download a program called "spin rite" & run that after making a complete image of your drive using Acronis or something similar for free off www.download.com
. While you're at that site, grab Advanced System Care Free edition & run that as well. That's an easy one click program to use & fixes alot of wierd ****. Make sure you go into the diagnose system section,run that also then under utilities run the disk cleanup,internet optimizer,follow the instructions for getting the defrag program & select smart ram (set that so it starts with windows,same with the defragger). If all that doesn't work, replace the hdd with a Western Digital of similar size & if you used Acronis you can simply mount the image onto the new drive & you're done. All your apps, settings & programs are the same! It's like taking someone's brain out,putting it in a pickle jar & putting it back in again with them being none the wiser,lol.