The incident happened on the 18.34 Glasgow Central to Ayr service on Saturday.
The victim, 35, approached a group of men to check their tickets. One of the group - described as about 6ft tall and of slim build - pulled her by the back of her head and made sexually explicit gestures. The woman was extremely upset.
The man responsible was wearing a grey flat cap, a wax-style jacket and jeans. He spoke with a local accent and had been drinking. It is believed the group got on at Irvine and went as far as Prestwick Town station.
Detective Constable Craig Jennings from British Transport Police is appealing for information and urging witnesses to come forward to help them solve an "unwelcome and unwarranted assault".