You can get an entire car with a more powerful engine for the $5K you're willing to spend on a swap. Try an 81-85 300SD for size if you want to stick with a Diesel. An 82-85 300D will have the same turbodiesel engine as the 300SD in the same body as your 240D.

If your 240D is so well kept that it warrants $7500, you might be a little disappointed with the 300s you can get for $5000. They'll be excellent commuters, but they will have signs of being almost 20 years old.