Gordon Brown has hailed Labour's victory in the Glenrothes by-election as a vote of confidence for the response to the economic downturn.