So, I'm going to assume the BB had a 30K and you have a 45K stack prior to everything.
Preflop: You min raise to 2K, player calls 2K, SB folds, BB calls 1K.
Pot = 6.5K
Flop = BB bets 2K, you call 2K, player raises to 6K, BB shoves 26K
Pot = 42.5K
You have 41K and have to call 26K to win a pot of 42.5K, giving you 1.63:1 odds. This is far less than the odds needed to hit the boat or better, even if the turn gives you more outs.
Was your fold good? Yes, it was in the fact that your opponent had 45 for the flopped straight, but at the same time, I think it's a hand worth calling because you beat so many other hands your opponent can be shoving with. Against a made straight, you have 7 outs to hit on the turn, and 10 outs to hit on the river.
Your opponents can easily be shoving:
-2 pairs like 67, 78
-over pairs like 99, 1010, and maybe JJ. 99 also gives them an OESD
-pairs + OESD like 56, 89
-over cards + OESD like J9s, Q9s, K9s, or A9s
My only question is why you played your set so passively, especially on this board? You even said you were hoping to hit a set when you min raised preflop. It hits, then you just call a small raise preflop, get concerned when someone makes a small raise, and auto-fold when someone shoves? Why? A set here is so strong, you should be 3betting on that flop with intent of getting all of your money in on the flop. Again, they're shoving a lot more hands than just a flopped straight. And if you pay them off, you pay them off. But I still think it's too strong of a hand to let go.