I'm not sure why, but it looks like you need to have a google docs account to view your spreadsheet (I already do so I don't know if that is normal or not).
Anway, it looks like what your spreadsheet is doing is to compare putting $20k into a TFSA (which can't be down until 2010 if you have a spouse or 2012 if you are single) vs. putting down $20k on your mortgage, then reborrowing it from the HELOC to invest.
If I have that right, then one thing seems to be missing from the SM calculation - the interest saved on the mortgage paydown.
I created a similar calculator that attempts to show whether it is better to invest borrowed money in a non-registered account, TFSA or put it into an RRSP and then take the refund and paydown the mortgage. I also created one where paying down the mortgage does not come into play.
Typically the best scenario is a combo of using the RRSP and mortgage paydown IF your marginal tax rate when you withdraw is less than your contribution rate. There are a lot of variables but the bigger the difference between those two numbers the more likely the RRSP-mortgage paydown wins.