What do you mean grammatically incorrect? The singular they was used by Shakespeare for heaven's sake, its not some recent invention. Rather, the prejudice against the singular they (and the split infinitive) stem from when people looked down on ways in which English deviated from the rules of Latin. Personally, I think its silly to call any construct thats been in use for hundreds of years among educated people% and serves a useful purpose "ungrammatical".
%The Chicago Manual of style lists "Addison, Austen, Chesterfield, Fielding, Ruskin, Scott, and Shakespeare."
Using "they" for an ambiguous singular pronoun is perfectly good English. It was deprecated by Victorian grammarians who wanted English to be like Latin (the same people who ordered us not to boldly split infinitives).