Inverness came from behind twice to earn a 2-2 draw at home to St Mirren in the Scottish Premier League.