That's perfectly legal. You have a flight out of Canada and you only stay 4 days. Can't see a problem. Except... be very careful on flying the last day of your allowed stay because if there's a problem with your flight to Toronto and you are rebooked on a flight on the next day then you will get an overstay and lose your VWP rights for life and will need to apply for a B1/B2 visa ongoing. There's no mercy here. Noone cares it's not your fault. Absolutely noone. Neither the airline nor the CBP. Of course, if you are going on land then it's all fine.
Someone already asked this from the CBP https://answers.yahoo.com/question/index?qid=20120315213348AA7hUir and here's the reply:
once your grace period has expired you are required to make a meaningful departure back to your home country. If you travel to a contiguous territory or adjacent island and try to reenter the US you could be denied entry
Pay attention to the word required and do not hang your hopes on "could".
Edit: in general, do not try to outsmart the CBP. No, you are not the first to think of it and if it's even slightly tricky then it's easier to presume it's forbidden. Even if you cooked up something truly convoluted that the CBP haven't seen yet (good luck) the immigration officer you meet can deny you entry just because (s)he doesn't like your convoluted trick without needing to give much of a reason to anyone and you have no appeal. The whole process is not in your favor.