Ruby 1.9 - 189 178 159 155 153 chars
f,n=$*
c=IO.read f
n.to_i.times{i=0;c=c.chars.map{|v|i+=1
v.?v:('...X'+v)[[83,2,-79].map{|j|c[i-j,3]}.to_s.count ?X]||?.}*''}
File.new('out.txt',?w)<
Edit:
Handles newlines with 4 chars less.
Can remove 7 more (v.?v:) if you allow it to clobber newlines when the live cells reach the edges.