You're returning a reference to local. That won't work. Read this:
Can a local variable's memory be accessed outside its scope?
Fix:
ptree getSubTree(const string& path)
{
return pt.get_child(path);
}
Your result was a manifestition of Undefined Behaviour and could be different on different days, compilers, runs...