diff --git a/lib/resque/errors.rb b/lib/resque/errors.rb
index <HASH>..<HASH> 100644
--- a/lib/resque/errors.rb
+++ b/lib/resque/errors.rb
@@ -4,4 +4,7 @@ module Resque
 
   # Raised when trying to create a job without a class
   class NoClassError < RuntimeError; end
+  
+  # Raised when a worker was killed while processing a job.
+  class DirtyExit < RuntimeError; end
 end
diff --git a/lib/resque/worker.rb b/lib/resque/worker.rb
index <HASH>..<HASH> 100644
--- a/lib/resque/worker.rb
+++ b/lib/resque/worker.rb
@@ -326,6 +326,15 @@ module Resque
 
     # Unregisters ourself as a worker. Useful when shutting down.
     def unregister_worker
+      # If we're still processing a job, make sure it gets logged as a
+      # failure.
+      if job
+        # Ensure the proper worker is attached to this job, even if
+        # it's not the precise instance that died.
+        job.worker = self
+        job.fail(DirtyExit.new)
+      end
+
       redis.srem(:workers, self)
       redis.del("worker:#{self}")
       redis.del("worker:#{self}:started")
Ensure a terminated worker's job is put in the error queue.