Put butternut squash in the microwave and cook on high, until soft, 2 to 3 minutes. Cut in half, scoop out seeds and cube. Bring a large pot of water to a boil. Add squash and cook until tender, about 15 minutes. Drain and mash.
In a 9x13 inch casserole dish combine 3 cups mashed butternut squash, white sugar, milk, vanilla extract, salt, flour, eggs and 1/4 cup melted margarine.
Bake in preheated oven for 45 minutes, or until set.
In a medium bowl combine crushed vanilla wafers, 1/2 cup melted margarine and brown sugar. Crumble over top of cooked casserole and return to oven to brown.