Without the particulars, it will be hard to help you here.
Look at your contract, or call the dealer. There will typically be fees if you want to get out of the lease. You should be able to avoid fees if you buy it, however - check how much the KBB value of the car currently is. If it is below 13k, you are paying an implicit fee.
Also, check your contract for the residual value at the end of the lease.
How many miles do you drive per year?
Armed with these numbers, you can make a better choice.
ETA: The 3k in lease payments you've already paid are a sunk cost. Ignore them.