Three players left in the game.
One is all in with $1000. Big blind is $4000.
Small blind $2000 and decides to fold, pre flop.
Your description is unclear, but I assume you mean that both blinds are posted complete, the third player (acting first) goes all in for $1000, and the small blind folds. In this case, the main pot is $3000--the first player's $1000, $1000 from the small blind, and $1000 from the big blind. The rest of the money goes to the big blind player immediately, and the remaining two players show down for the $3000.
A player all in is eligible to win the amount he contributed to the pot from each other player, and no more.