Perl to the rescue:
#!/usr/bin/perl
use warnings;
use strict;
use Fcntl qw{ SEEK_SET SEEK_CUR };
my $pos = 50;
open my $BIN, '+<:raw', shift or die $!;
seek $BIN, $pos - 1, SEEK_SET or die "Can't seek into file.\n";
my $size = read $BIN, my $data, 1;
die "Can't read 50th byte from file.\n" unless $size;
if ("\0" eq $data) {
    seek $BIN, - 1, SEEK_CUR;
    print {$BIN} "\xff";
    close $BIN;
} else {
    warn "Nothing to replace, 50th byte isn't a zero.\n";
}
- +<opens the file in the read/write mode.
- :rawremoves any IO layers (e.g. CRLF translation)
- seekrewinds the position in a filehandle.