www.dainco.es has daily direct buses from Ourense to Salamanca and that's probably your best bet. On your travel date they just have a bus making that route departing from Ourense at 19:05 and arriving to Salamanca at 23:35
By train, you would need to change trains in Medina del Campo and means a detour. If you are a train fan but want to avoid the detour going changing trains in Medina del Campo, you might consider the option of taking the train from Ourense to Zamora and a bus from Zamora to Salamanca. Take a look at
www.renfe.com for train info (make a separate search for each leg because the renfe site isn't good showing -all- the options on routes meaning a change of trains along them. I mean make a search for the leg from Ourense to Medina del Campo and a separate one for the leg from Medina del Campo to Ourense) and at
www.zamorasalamanca.es for bus info on the route from Zamora to Salamanca.
P.S.: You might need to wait some time (maybe till early September) to see the train schedule uploaded to the RENFE web.