For centuries before the Holocaust, Jews flourished in a town known for its railway connections. Now, the house of prayer is the final testament to the community's heyday