Regarding the opportunity cost comparison, consider the following two scenarios assuming a three-year lease:
Option A: Keep your current car for three years
In this scenario, you start with a car that's worth $10,000 and end with a car that's worth $7,000 after three years.
Option B: Sell your current car, invest proceeds, lease new car
Here, you'll start out with $10,000 and invest it. You'll start with $10,000 in cash from the sale of your old car, and end with $10,000 plus investment gains.
You'll have to estimate the return of your investment based on your investing style.
Option C: Use the $10k from proceeds as down payment for new car
In this scenario you'll get a reduction in finance charges on your lease, but you'll be out $10,000 at the end.
Overall Cost Comparison
To compare the total cost to own your current car versus replacing it with a new leased car, first look up the cost of ownership for your current car for the same term as the lease you're considering. Edmunds offers this research and calls it True Cost to Own.
Specifically, you'll want to include depreciation, fuel, insurance, maintenance and repairs. If you still owe money you should also factor the remaining payments. So the formula is:
Cost to keep car = Depreciation + Fuel + Insurance + Maintenance + Repairs
On the lease side consider taxes and fees, all lease payments, fuel, and maintenance. Assume repairs will be covered under warranty. Assume you will put down no money on the lease and you will finance fees, taxes, title, and license when calculating lease payments. You also need to consider the cost to pay off your current car's loan if applicable. Then you should subtract the gains you expect from investing for three years the proceeds from the sale of your car.
Assume that repairs will be covered under warranty. The formula to lease looks like:
Lease Cost = Fuel + Insurance + Maintenance + Lease payments - (gains from investing $10k)
For option C, where you use the $10k from proceeds as down payment for new lease, it will be:
Lease Cost = Fuel + Insurance + Maintenance + Lease payments + $10,000
A somewhat intangible factor to consider is that you'll have to pay for body damage to a leased car at the end of the lease, whereas you are obviously free to leave damage unrepaired on your own vehicle.