First, read the fine print on the lease.
I suspect that you have the right to buy out the vehicle at the residual. If so, then find out what the vehicle is worth (if it's worth 12, great). If the fmv is greater than the buyout, then the dealer should be willing to take it as trade on a newer with your equity (the 12 less the buyout). Keep in mind that if you buy it out or trade it, you should not have to pay any mileage penalty (as it is implicit in the fmv). Keep in mind, as well, the dealer will only give you wholesale value on the vehicle as a trade.