Thanks to all who replied. I ended up taking the bus through the Mont Blanc tunnel to Chamonix. The bus stop is very close to Chamonix-Aiguille du Midi rail station, and I initially looked for a connection there, which was very tight. However Swiss-bound trains in the morning have a very long layover in Chamonix-Mont-Blanc station, and it proved easy to walk there in plenty of time for the train to Martigny via Vallorcine.
The Mont Blanc express to Martigny is highly recommended. One particular highlight was the Tunnel des Montelets - a single track combined road/rail tunnel which has to be seen to be believed! On the Swiss side of the border, the line runs along the side of a steep gorge and offers spectacular views across to the mountains on the other side. The line is third rail electrified with a number of rack sections, and some steep non-rack sections have short lengths of overhead electrification, presumably to provide extra power when climbing. The descent into Martigny was sensational - a twisting steep drop down the side of the gorge.
Martigny station was remarkably busy - in the 15 minutes I was there I think there were a good ten train movements, including a German freight and a propelling wagon shunt. I took a train to Saint Maurice, where I had a six minute connection for Bex. No problem in Switzerland of course - this was an advertised itinerary and one of four sub 10 minute connections I made in the day.
Bex has a rack tramway/railway climbing to Villars-sur-Ollon, a ski resort from where another rack railway climbs well up into the snow. Time did not permit me to go as far as Col-de-Bretaye, and I descended by bus to Aigle, from where I returned to Martigny and then retraced my steps back to Italy.
I can highly recommend this outing, which cost approximately £105 when booked the day before travel.