This is usually caused by badly written device drivers, which have memory leaks. If one can't find out what driver is causing it and can replace it with a better one, then Add/update this line in the SYSTEM.INI in the [386Enh] section :
There are no spare stack pages. It may be necessary to increase the setting of 'MinSPs' in System.ini to prevent possible stack faults. There are currently <nnn> SPs allocated.
Windows Terminating thread due to a stack overflow problem. A VxD, possibly recently installed, has consumed too much stack space. Increase the setting of MinSPs in System.INI or remove recently installed VxDs. There are currently <nnn> SPs allocated.
Increase the MinSPs with increment of 4 until the errors stops coming. This setting has nothing to do with STACKS= in the CONFIG.SYS (Though if STACKS= is set too low, then it can also introduce stack overflow in Windows)
More Info MS KB145799
More Info MS KB149083