Well you can give it a try and see how it goes - just have a thermometer in there (on the opposite side of the tank) to check the temperature.
It's most certainly far from ideal, but if you don't have a choice it "could" possibly do.
I know some heaters actually state the minimum tank size on the packaging.