This itinery had problems - finding accommodation in SF close to the train station - recovering from 8hrs jetlag - getting about in Merced, having enough time to buy food, re-package and send on to MTR etc..
As it happened however, at the last minute a friend offered to pick me up from the airport, allow me to stay with them for a couple of days - then take me to Yosemite - how good was that? I appreciate though that this means I can't advise you about whether my plan worked, sorry about that!
I hunted about for the best deal on flights and BA seemed to be the best. I was also very impressed by the BA website which showed you a long list of flight options with the connections and total journey time clearly shown for each one. This allowed me to choose the shortest direct flight at the best price.
My JMT guidebook suggests flying in to San Francisco but back to the UK via Los Angeles, which is easier to get to from the end of the trail. The price of two flights as opposed to one 'return' flight really increased the cost somewhat - so I resolved to get back to SF from the end of the trail - thus kept the flight cost to a minimum.
One the way to the US my itinery was: