I did a portion of this trip about a month ago, though in the other direction. I went to from Sarajevo to Sofia. If you want to go overland probably the best route would be train from Istanbul to Sofia, then take the train from Sofia to Niš (the train does go all the way to Belgrade but it will cut down on the time as you will need to take a bus regardless, as far as I know). There is a direct bus from Niš to Sarajevo at least twice a day.
When I went from Sarajevo to Sofia, I left Sarajevo bus station at 830am and arrived in Sofia around 10am the next day, so figure that plus whatever it takes for the train to go from Istanbul to Sofia (10 hrs?, maybe more with customs and immigration at the Turkey/Bulgarian border).
If time is an issue I would say fly. Even the most direct overland trip would take at least two days. The price would be comparable to the budget flight that you mention.