Connor Allan scored a sublime late winner as Falkirk moved up to fourth in the Scottish Premiership after coming from behind to beat Dundee 2-1 at the Falkirk Stadium.