The future of the Labor opposition leader in New South Wales is in doubt after a disastrous by-election result in the Upper Hunter valley.