After losing some socks, Caroline has 40 - 4 = <<40-4=36>>36 pairs of socks
Caroline donates 36 * (2/3) = <<36*(2/3)=24>>24 pairs of socks to the thrift store
After donating some socks, Caroline has 36 - 24 = <<36-24=12>>12 pairs of socks remaining
After getting new socks, Caroline has 12 + 10 + 3 = <<12+10+3=25>>25 pairs of socks
#### 25